# 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

{% hint style="success" %}
**FEW DEFINITIONS:**

**Anagram**: A word or phrase that is made by arranging the letters of another word or phrase in a different order
{% endhint %}

## Some Cool Solutions

### Sum of Digits

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

### Bitwise Operations in Python

<< and >>

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ankit-apdc.gitbook.io/python-1/data-structure/problem-solving-techniques.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
