-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debugging.txt
14 lines (14 loc) · 712 Bytes
/
Debugging.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1] int overflow (always use ll for sum variable).
2] for loop boundary conditions
3] ; after for loop
4] changing value of variable and then using the changed value
eg : cin >> a >> b;
a -= min(a,b); //value of a is changed here
b -= min(a,b);
5] Applying binary search OR lower/upper bound on unsorted array.
6] while using MOD functions, check if arguments itself are <= MOD
7] Be carefull while checking bits : use (1LL << i) instead of (1<<i)
8] In graph questions if you are using 0 indexing for nodes! Take Care.
9] for ll integers use __builtin_popcountll()
10] Remember : ceil() and floor() take 'double' argument.
11] Avoid memset() cause you dont know how it works! Better use 'fill' or for loops.