Find a triplet with the given sum in an array
Given an unsorted integer array, find a triplet with a given sum in it.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an unsorted integer array, find a triplet with a given sum in it.
Given an integer array having distinct elements, find the surpasser count for each element in it. In other words, for each array element, find the total number of elements to its right, which are greater than it.
Introsort is an efficient in-place sorting algorithm, which usually beats all other sorting algorithms in terms of performance. Due to its high performance, it is used in several standard library sort functions.
Implement your diff utility, i.e., given two similar strings, efficiently list out all differences between them. The diff utility is a data comparison tool that calculates and displays the differences between the two texts.
Write an efficient algorithm to print the two-dimensional view of a binary tree.
Quicksort exhibits poor performance for inputs that contain many repeated elements. The problem is visible when all the input elements are equal. In this post, we will implement Quicksort efficiently for inputs containing many repeated elements.
Given a string, remove adjacent duplicates characters from it. In other words, remove all consecutive same characters except one.
Write an algorithm to compute a binary tree’s height with leaf nodes forming a circular doubly linked list where the leaf node’s left and right pointers will act as a previous and next pointer of the circular doubly linked list, respectively.
Given two arrays of positive integers, add their elements into a new array. The solution should add both arrays, one by one starting from the 0th index, and split the sum into individual digits if it is a 2–digit number
Write code to print all combinations of positive integers in increasing order that sum to a given positive number.
Given a string and a pattern, determine if the pattern matches with the string or not. The solution should not use any regex.
Write an efficient algorithm to check if a given string is k–palindrome or not. A string is k–palindrome if it becomes a palindrome on removing at most k characters from it.