Skip to content

Instantly share code, notes, and snippets.

@mdtareque
Last active September 5, 2021 14:33
Show Gist options
  • Save mdtareque/31ba2f26db1d96ad2ce07fc898e31b02 to your computer and use it in GitHub Desktop.
Save mdtareque/31ba2f26db1d96ad2ce07fc898e31b02 to your computer and use it in GitHub Desktop.
kadane https://leetcode.com/submissions/detail/545186446/
sudoku solver https://leetcode.com/submissions/detail/542160718/
cantor's diagonalization https://leetcode.com/problems/find-unique-binary-string/discuss/1418687/Detailed-Explanation-O(N)-Java-C%2B%2B-Python-short-concise-code-Cantor's-Diagonalization
unexpected binary search
https://leetcode.com/submissions/detail/539776707/
normalize array https://www.geeksforgeeks.org/count-inversions-array-set-3-using-bit/
mergeSort inversionCount https://www.hackerearth.com/practice/algorithms/sorting/merge-sort/tutorial/
unionFind:
normal and weighted
https://www.hackerearth.com/submission/4517329/
generic solution,
find number of s that can be formed with chars in t
https://leetcode.com/submissions/detail/537300191/
All algos
https://docs.microsoft.com/en-us/cpp/standard-library/algorithm?view=msvc-160
Ostream
https://docs.microsoft.com/en-us/cpp/standard-library/overloading-the-output-operator-for-your-own-classes?view=msvc-160
class Date
{
int mo, da, yr;
public:
Date(int m, int d, int y)
{
mo = m; da = d; yr = y;
}
friend ostream& operator<<(ostream& os, const Date& dt);
};
ostream& operator<<(ostream& os, const Date& dt)
{
os << dt.mo << '/' << dt.da << '/' << dt.yr;
return os;
}
timeout
https://docs.microsoft.com/en-us/cpp/standard-library/effects-of-buffering?view=msvc-160
cout formatting
https://docs.microsoft.com/en-us/cpp/standard-library/using-insertion-operators-and-controlling-format?view=msvc-160
c++ lambda examples
https://docs.microsoft.com/en-us/cpp/cpp/examples-of-lambda-expressions?view=msvc-160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment