Javascript Program for Largest Sum Contiguous Subarray
Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum....
read more
Javascript Program For Reversing A Linked List In Groups Of Given Size – Set 1
Given a linked list, write a function to reverse every k nodes (where k is an input to the function)....
read more
Count total set bits in all numbers from range L to R
Given two positive integers L and R, the task is to count the total number of set bits in the binary representation of all the numbers from L to R....
read more
Merge two unsorted linked lists to get a sorted list
Given two unsorted Linked List, the task is to merge them to get a sorted singly linked list.Examples:...
read more
Maximum Tip Calculator
Rahul and Ankit are the only two waiters in the Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when handled by different waiters and given as arrays A[] and B[] such that if Rahul takes the ith Order, he would be tipped A[i] rupees, and if Ankit takes this order, the tip would be B[i] rupees....
read more
Implement Undo and Redo features of a Text Editor
Given an array of strings Q[], consisting of queries of the following types:...
read more
Minimum moves required to come out of a grid safely
Given a grid mat[][] of size M * N, consisting of only 0s, 1s, and 2s, where 0 represents empty place, 1 represents a person and 2 represents the fire, the task is to count the minimum number of moves required such that the person comes out from the grid safely. In each step, the fire will burn its side-adjacent cells and the person will move from the current cell to one of its side-adjacent cells. If it is not possible to come out from the grid, then print -1....
read more
Largest Sum Contiguous Subarray (Kadane’s Algorithm)
Given an array arr[] of size N. The task is to find the sum of the contiguous subarray within a arr[] with the largest sum....
read more
Pair with given Sum (Two Sum)
Given an array A[] of n numbers and another number x, the task is to check whether or not there exist two elements in A[] whose sum is exactly x....
read more
Lexicographically largest string possible consisting of at most K consecutive similar characters
Given a string S and an integer K, the task is to generate lexicographically the largest string possible from the given string, by removing characters also, that consist of at most K consecutive similar characters....
read more
Check if two trees are Mirror
Given two Binary Trees, write a function that returns true if two trees are mirror of each other, else false. For example, the function should return true for following input trees....
read more
Java Program For Reversing A Linked List In Groups Of Given Size – Set 1
Given a linked list, write a function to reverse every k nodes (where k is an input to the function)....
read more