### Maximum Subarray Problem

Problem Statement You are given an array of integers. And, you have find the…

September 04, 2020

Write a function that reverses a string. The input string is given as an array of characters char[].

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

You may assume all the characters consist of printable ascii characters.

**Example**

```
Input: ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
```

Its very simple problem to solve.

- Take two index variables
- Start one from left, other from extreme end
- Start swapping their values, and move them

Left in forward, and extreme right in backward - Repeat above untill both index variables cross each other

```
public void reverseString(char[] s) {
int left = 0;
int end = s.length-1;
while (left < end) {
//swap
char temp = s[left];
s[left] = s[end];
s[end] = temp;
left ++;
end --;
}
}
```

Its `O(n)`

Problem Statement You are given an array of integers. And, you have find the…

Min Priority Queue is a data structure which manage a list of keys(values). And…

Problem Statement Write a function to find the longest common prefix string…

Problem Statement Given a Binary tree, print out nodes in level order traversal…

Problem Statement Given a string, find the first non-repeating character in it…

First try to understand question. Its a binary tree, not a binary search tree…

In this post, we will see some of the frequently used concepts/vocabulary in…

System design interview is pretty common these days, specially if you are having…

Introduction You are given an array of integers with size N, and a number K…

Graph Topological Sorting This is a well known problem in graph world…

Problem Statement Given a Binary tree, print out nodes in level order traversal…

Problem Statement Given an array nums of n integers and an integer target, are…