Young Tableau problem - Cormen
Young Tableau A a X b matrix is Young Tableau if all rows(from left to right…
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.
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)
Young Tableau A a X b matrix is Young Tableau if all rows(from left to right…
Max Priority Queue is a data structure which manage a list of keys(values). And…
Problem Statement Given n non-negative integers a1, a2, …, an , where each…
Big-O notation In simpler terms, its kind of a unit to measure how efficient an…
Problem Statement Determine if a 9x9 Sudoku board is valid. Only the filled…
Here are some tips while giving your coding interviews. 1. Never try to jump to…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction There are some cases, where I need another git repository while…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction Java log4j has many ways to initialize and append the desired…