Blind 75 - Invert Binary Tree
Swap left and right. Then repeat for those nodes.
Swap left and right. Then repeat for those nodes.
Have a fast pointer and a slow pointer. fast increases by 2. slow increases by 1. if both become the same then the cycle exists. if fast one reaches end then no cycle exists.
go to each depth, incrementing a depth counter by 1. return max of it.
Iterate over both and store minimum one in current; Increment in the list from where minimum came. Once one of the lists is empty, empty the other one.
Check if the last bit is 1 by (n&1). Do the right unsigned shift (logical shift >>>). Loop.
Get the last bit of value from the original. append to the reverse one. shift reverse one to the left. instead of adding, you can do `or` because after the shift last value will be 0. Imp - iterate 32 times only.
Similar to swapping two numbers. Start with prev as null and current and keep swapping next. Return prev because that's the last value.
Placeholder
Check if root is same as subtree or root.left is same or root.right is same;
Make sure the left pointer is always the lowest yet. Keep checking the difference between left and right. And return max.
Have 2 pointers. One at the start other at the end. Skip if `!Character.isLetterOrDigit` and compare with `Character.toLowerCase`
God-level solution - iterate.<br>If an opening bracket is found, put the closing bracket in a stack.<br>If the closing bracket is found, pop and check for equality.
Loop twice.<br>first right to left while multiplying.<br>Then second left to right while multiplying.<br>This can be done in a single array and one extra product variable
Create a set and put items in one by one while checking if `num` is already there.
compare the count of letters in each word and put group them in a map
count all numbers. sort. and return top k. Use streams to make it cleaner. or use bucket sort.
check if the length is the same.<br> find the difference in the count of letters in both numbers.<br> since there are only 26 letters, you can count in a single int array of 26. <br>index = char - 'a'
Make a map of item and index. Check if target - currentItem exists.