Problem Solving Techniques

Two Pointer Method

Declare two pointers, one is faster (increment by 2) compared to slower (increment by 1)

  • Find the centre element of a LinkedList

    • When faster reaches the end node, slower one will be at the mid node

  • Check if a LinkedList is cyclic or not

    • If cyclic, then, at one point in time slower and faster pointers will be at the same point

Binary Search Problems

Using while/for loop or using recursion

https://medium.com/techie-delight/binary-search-practice-problems-4c856cd9f26c

Recursion

Some Cool Solutions

Sum of Digits

Mathematical Solution is brilliant: https://leetcode.com/problems/add-digits/solution/

Bitwise Operations in Python

<< and >>

Last updated

Was this helpful?