In this post, we will talk about Collectors toCollection() method in Java.
In this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.
Write an algorithm to compute the height of a binary tree with leaf nodes forming a circular doubly linked list where the left and right pointers of the leaf node will act as a previous and next pointer of circular doubly linked list respectively. For example, consider below binary tree. The leaf nodes are …
Given an array of sorted integers which may have several duplicates elements, count the number of distinct absolute values in the array.
Given an integer, reverse its bits using binary operators. The idea is to initialize the result by 0 (all bits 0) and process the given number starting from its least significant bit. If the current bit is 1, then we set the corresponding most significant bit in the result and finally move on …
Given two arrays of positive integers, add their elements into a new array. The solution should add elements of both arrays one by one starting from 0’th index and split the sum into individual digits if it’s a two-digit number.
Write code to print all combinations of positive integers in increasing order that sum to a given positive number.
In this post, we will see how to implement a Multiset in Java.
Given a string and a pattern, determine if the pattern matches with the string or not. The solution should not use any regex.
In this post, we will discuss how to delete extra separator from the end of a String that gets added while looping through a Collection and adding each item to a String separated by a separator.
Guava com.google.common.primitives package provides utility classes for all primitives types such as Chars, Longs, Ints, Doubles, etc. In this article, we will talk about Guava Chars class which provides static utility methods to work with primitive char array.
A string is K-Palindrome if it becomes a palindrome on removing at most k characters from it. Write an algorithm to check if a given string is K-Palindrome or not.