Featured Article

Longest common subsequence with permutations allowed

Given two strings in lowercase, find the longest string whose permutations are subsequences of given two strings. The output longest string must be sorted. Examples: Input : str1 = “pink”, str2 = “kite” Output : “ik” The string “ik” is the longest sorted string whose one permutation “ik” is subsequence of “pink” and another permutation… Read More »

Featured Article

Count ways to spell a number with repeated digits

Given a string that contains digits of a number. The number may contain many same continuous digits in it. The task is to count number of ways to spell the number. For example, consider 8884441100, one can spell it simply as triple eight triple four double two and double zero. One can also spell as… Read More »

Featured Article

How JVM Works – JVM Architecture?

JVM(Java Virtual Machine) acts as a run-time engine to run Java applications. JVM is the one that actually calls the main method present in a java code. JVM is a part of JRE(Java Run Environment). Java applications are called WORA (Write Once Run Everywhere). This means a programmer can develop Java code on one system… Read More »

Arrays.deepToString() in Java with Example

java.util.Arrays.deepToString(Object[]) method is a java.util.Arrays class method. Returns a string representation of the “deep contents” of the specified array. If the array contains other arrays as elements, the string representation contains their contents and so on. This method is designed for converting multidimensional arrays to strings. The simple toString() method works well for simple arrays,… Read More »

String to Integer in Java – parseInt()

While operating upon strings, there are times when we need to convert a number represented as a string into an integer type. The method generally used is parseInt(). How to use parseInt() method in Java? There are two variants of this method: public static int parseInt(String s) throws NumberFormatException – This function parses the string… Read More »

MakeMyTrip Interview Experience | Set 13 (On-Campus for Full Time)

I recently got interviewed for MakeMyTrip for the Software Engineer full time position. There were in a total of 5 rounds. First Round (Online Coding + Aptitude): Firstly don’t expect the online interface to be friendly. There were 3 sections. First section was aptitude which had very very simple questions like addition, subtraction. Second section… Read More »

CountDownLatch in Java

CountDownLatch is used to make sure that a task waits for other threads before it starts. To understand its application, let us consider a server where the main task can only start when all the required services have started. Working of CountDownLatch: When we create an object of CountDownLatch, we specify the number if threads… Read More »

Arrays.fill() in Java with Examples

java.util.Arrays.fill() method is in java.util.Arrays class. This method assigns the specified data type value to each element of the specified range of the specified array. Syntax: // Makes all elements of a[] equal to “val” public static void fill(int[] a, int val) // Makes elements from from_Index (inclusive) to to_Index // (exclusive) equal to “val”… Read More »

Arrays.sort() in Java with examples

sort() method is a java.util.Arrays class method. Syntax: public static void sort(int[] arr, int from_Index, int to_Index) arr – the array to be sorted from_Index – the index of the first element, inclusive, to be sorted to_Index – the index of the last element, exclusive, to be sorted This method doesn’t return any value. A… Read More »