Basic java Programs This repository has solutions to alist of JAva PRograms.
Program to display the String in zigzag pattern.(Question from Leetcode)
Solution
Recursively remove all adjacent duplicates from a String. (Question from Leetcode)
Solution
Remove the k duplicate characters from a string (Question from Leetcode)
Input: s = "deeedbbcccbdaa", k = 3
Output: "aa"
Explanation:
First delete "eee" and "ccc", get "ddbbbdaa"
Then delete "bbb", get "dddaa"
Finally delete "ddd", get "aa"
Solution
Find the length of longest increasing subsequence using Dynamic Programming approach(Question from Leetcode)
Input: [10,9,2,5,3,7,101,18]
Output: 4
Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.
Solution
Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.(Question from Leetcode)
Solution
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
Solution
Given a binary tree, write a function to get the maximum width of the given tree.
Solution
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.(Leetcode question 543)
Solution
The count-and-say sequence is the sequence of integers with the first five terms as following:(Leetcode question)
Solution
Longest Valid Parenthesis
Solution