Showing posts with label Interview Preparation Kit. Show all posts
Showing posts with label Interview Preparation Kit. Show all posts

Tuesday, October 27, 2020

Flipping bits - Hacker Rank Solution

 You will be given a list of 32 bit unsigned integers. Flip all the bits ( and ) and print the result as an unsigned integer.

Maximum Xor - Hacker Rank Solution

 You are given an array  of  elements. A list of integers,  is given as an input, find the maximum value of  for all  , where  represents xor of two elements.

Friend Circle Queries - Hacker Rank Solution

 The population of HackerWorld is . Initially, none of the people are friends with each other. In order to start a friendship, two persons  and  have to shake hands, where . The friendship relation is transitive, that is if  and  shake hands with each other,  and friends of  become friends with  and friends of .

Time Complexity: Primality - Hacker Rank Solution

 A prime is a natural number greater than  that has no positive divisors other than  and itself. Given  integers, determine the primality of each integer and print whether it is Prime or Not prime on a new line.

Recursion: Fibonacci Numbers - Hacker Rank Solution

The Fibonacci Sequence

The Fibonacci sequence appears in nature all around us, in the arrangement of seeds in a sunflower and the spiral of a nautilus for example.

Saturday, February 23, 2019

Making Candies - Hacker Rank Solution

Karl loves playing games on social networking sites. His current favorite is CandyMaker, where the goal is to make candies.
Karl just started a level in which he must accumulate  candies starting with  machines and  workers. In a single pass, he can make  candies. After each pass, he can decide whether to spend some of his candies to buy more machines or hire more workers.

Maximum Subarray Sum - Hacker Rank Solution

We define the following:
  • subarray of array  of length  is a contiguous segment from  through  where .
  • The sum of an array is the sum of its elements.

Minimum Time Required - Hacker Rank Solution

You are planning production for an order. You have a number of machines that each have a fixed number of days to produce an item. Given that all the machines operate simultaneously, determine the minimum number of days to produce the required order.

Triple sum - Hacker Rank Solution

Given  arrays  of different sizes, find the number of distinct triplets  where  is an element of , written as , and , satisfying the criteria: .
Powered by Blogger.