Skip to content

Instantly share code, notes, and snippets.

View msinvent's full-sized avatar
🏠
Working from home

Manish Sharma msinvent

🏠
Working from home
View GitHub Profile
bool isAnagram(const std::string& str1, const std::string& str2)
{
if(str1.size() != str2.size()){
return false;
}
constexpr uint16_t maxSizeOfMap = 1<<(sizeof(char)*8);
std::array<uint32_t,maxSizeOfMap> mapStr1;
std::array<uint32_t,maxSizeOfMap> mapStr2;
// Don't forget to perform initialization of variables in C++
@msinvent
msinvent / isAnagramMapImplementation.cpp
Last active July 13, 2020 02:10
isAnagram function description
bool isAnagram(const std::string& str1, const std::string& str2)
{
if(str1.size() != str2.size()){
return false;
}
std::unordered_map<char,uint32_t> mapStr1;
std::unordered_map<char,uint32_t> mapStr2;
constexpr uint16_t maxSizeOfMap = 1<<(sizeof(char)*8);
@msinvent
msinvent / isAnagramNlogN.cpp
Last active July 13, 2020 02:07
All O(1) are not same sample code 1
bool isAnagram(const std::string& str1, const std::string& str2){
// Two string can't be anagram if they are of different size [O(1)]
if(str1.size()!=str2.size()){
return false;
}
// Copy have to be done to sort it later [O(n) space and O(n) time both]
std::string str1Copy = str1;
std::string str2Copy = str2;
@msinvent
msinvent / Install NVIDIA Driver and CUDA.md
Created April 9, 2019 18:28 — forked from zhanwenchen/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 9.0 on Ubuntu 16.04.4 LTS
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@msinvent
msinvent / Caffe Ubuntu 15.10.md
Created June 9, 2017 23:50 — forked from wangruohui/Caffe Ubuntu 15.10.md
Compile and run Caffe on Ubuntu 15.10

Ubuntu 15.10 have been released for a couple of days. It is a bleeding-edge system coming with Linux kernel 4.2 and GCC 5. However, compiling and running Caffe on this new system is no longer as smooth as on earlier versions. I have done some research related to this issue and finally find a way out. I summarize it here in this short tutorial and I hope more people and enjoy this new system without breaking their works.

Install NVIDIA Driver

The latest NVIDIA driver is officially included in Ubuntu 15.10 repositories. One can install it directly via apt-get.

sudo apt-get install nvidia-352-updates nvidia-modprobe

The nvidia-modprobe utility is used to load NVIDIA kernel modules and create NVIDIA character device files automatically everytime your machine boots up.

Reboot your machine and verify everything works by issuing nvidia-smi or running deviceQuery in CUDA samples.