Given a positive integer n which represents the dimensions of a 4n x 4n matrix with values from 1 to n filled from left to right and top to bottom. Form two coils from the matrix and print the coils....
In a move shaking up the online news world, Yahoo announced the acquisition of Artifact, an AI-powered news startup founded by Instagram’s co-founders, Kevin Systrom and Mike Krieger. This acquisition means Yahoo’s strategic shift towards Yahoo AI news and using the power of AI for a more personalized news experience....
Given a number, find the next smallest palindrome larger than this number. For example, if the input number is “2 3 5 4 5”, the output should be “2 3 6 3 2”. And if the input number is “9 9 9”, the output should be “1 0 0 1”. The input is assumed to be an array. Every entry in array represents a digit in input number. Let the array be ‘num[]’ and size of array be ‘n’...
Serialization is to store the tree in a file so that it can be later restored. The structure of the tree must be maintained. Deserialization is reading the tree back from a file....
Given a positive integer n which represents the dimensions of a 4n x 4n matrix with values from 1 to n filled from left to right and top to bottom. Form two coils from the matrix and print the coils....
Given a stream of characters and we have to find first non repeating character each time a character is inserted to the stream....
Given that integers are read from a data stream. Find the median of elements read so far in an efficient way....
Given an array of 1s and 0s which has all 1s first followed by all 0s. Find the number of 0s. Count the number of zeroes in the given array.Examples :...
Given an even number (greater than 2 ), print two prime numbers whose sum will be equal to given number. There may be several combinations possible. Print only first such pair. An interesting point is, a solution always exist according to Goldbach’s conjecture.Examples :...
Given a positive integer n which represents the dimensions of a 4n x 4n matrix with values from 1 to n filled from left to right and top to bottom. Form two coils from the matrix and print the coils....
Given a stream of characters, find the first non-repeating character from the stream. You need to tell the first non-repeating character in O(1) time at any moment....
Given that integers are being read from a data stream. Find the median of all the elements read so far starting from the first integer till the last integer. This is also called the Median of Running Integers. The data stream can be any source of data, for example, a file, an array of integers, input stream etc....