### Find the Median of Two Sorted Arrays - Leet Code Solution

Problem Statement There are two sorted arrays nums1 and nums2 of size m and n…

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 There are two sorted arrays nums1 and nums2 of size m and n…

Its every software engineer’s dream to work with the big FAANG companies…

Problem Statement You are given an n x n 2D matrix representing an image, rotate…

Problem Statement Given a signed integer, reverse digits of an integer. Return…

Problem Statement Given a string s, find the longest palindromic substring in s…

Young Tableau A a X b matrix is Young Tableau if all rows(from left to right…

Problem Statement You are given a string text of words that are placed among…

Problem Statement You are given a rows x cols matrix grid. Initially, you are…

Problem Statement Given a string s, return the maximum number of unique…

Problem The Leetcode file system keeps a log each time some user performs a…

Problem Statement Replace all spaces in a string with ‘%20’ (three characters…

Problem Implement an algorithm to determine if a string has all the characters…