Currently practicing: NeetCode Blind 75

Insights

  • For tree problems, recursive DFS is cleanest to implement.

Problems Solved

Make a map of item and index. Check if target - currentItem exists.
check if the length is the same.
find the difference in the count of letters in both numbers.
since there are only 26 letters, you can count in a single int array of 26.
index = char - 'a'
Loop twice.
first right to left while multiplying.
Then second left to right while multiplying.
This can be done in a single array and one extra product variable
Have 2 pointers. One at the start other at the end. Skip if `!Character.isLetterOrDigit` and compare with `Character.toLowerCase`
God-level solution - iterate.
If an opening bracket is found, put the closing bracket in a stack.
If the closing bracket is found, pop and check for equality.
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.
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.
Similar to swapping two numbers. Start with prev as null and current and keep swapping next. Return prev because that's the last value.
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.