PuzzlersWorld.com

  • Hacker Puzzle
  • Interview Puzzles
  • Number Puzzles
  • Maths Puzzles
All Puzzles Solved Unsolved

Cookie Clicker Alpha Solution – Google Code Jam 2014

April 12, 2014 by puzzler 3 Comments

This is the second problem for Google Code Jam Qualification round 2014, if you are able to solve this problem with the first one(which is very easy) you will be eligible for the next round.

Problem

In this problem, you start with 0 cookies. You gain cookies at a rate of 2 cookies per second, by clicking on a giant cookie. Any time you have at least C cookies, you can buy a cookie farm. Every time you buy a cookie farm, it costs you C cookies and gives you an extra F cookies per second.

Once you have X cookies that you haven’t spent on farms, you win! Figure out how long it will take you to win if you use the best possible strategy.
[Read more…]

Checkout more Google Code jam Tags: medium, Solved Puzzles

Magic Trick Solution – Google Code Jam 2014

April 12, 2014 by puzzler 3 Comments

Google Code Jam 2014 has begun, You need to get 25 points to get to the next round, there are 4 problems out of which two problems needs to be solved for sure to get into next round.

This is the first problem and the most simpler one and gives you only 6 points 🙁

Problem

Recently you went to a magic show. You were very impressed by one of the tricks, so you decided to try to figure out the secret behind it!

The magician starts by arranging 16 cards in a square grid: 4 rows of cards, with 4 cards in each row. Each card has a different number from 1 to 16 written on the side that is showing. Next, the magician asks a volunteer to choose a card, and to tell him which row that card is in.
[Read more…]

Checkout more Google Code jam Tags: Easy, Solved Puzzles

DS with insert, delete and getRandomElement in O(1)

July 5, 2013 by puzzler Leave a Comment

Problem Statement

Design a data structure that allows insert, delete and getRandomElement() 
in constant time i.e. O(1).

[Read more…]

Checkout more Interview Questions Tags: Data Structures, Solved Puzzles

implement isPalindrome(int n)

June 27, 2013 by puzzler 2 Comments

Problem Statement

Implement the function boolean isPalindrome (int n);

Which will return true if the bit-wise representation of the integer 
is a palindrome and false otherwise.

[Read more…]

Checkout more Interview Questions Tags: Algorithm, Amazon Interview Questions, medium, Solved Puzzles

Consonants Solution: Google codejam 2013 Round 1C

May 20, 2013 by puzzler Leave a Comment

Most of us are familiar with google codejam, those who don’t visit https://code.google.com/codejam for more information. This is the first problem from Online Round 1C 2013, top 1000 from this round will be eligible for next online round.

Problem Statement

In English, there are 26 letters that are either vowels or consonants. In this problem, we consider a, e, i, o, and u to be vowels, and the other 21 letters to be consonants.

A tribe living in the Greatest Colorful Jungle has a tradition of naming their members using English letters. But it is not easy to come up with a good name for a new member because it reflects the member’s social status within the tribe. It is believed that the less common the name he or she is given, the more socially privileged he or she is.

The leader of the tribe is a professional linguist. He notices that hard-to-pronounce names are uncommon, and the reason is that they have too many consecutive consonants. Therefore, he announces that the social status of a member in the tribe is determined by its n-value, which is the number of substrings with at least n consecutive consonants in the name. For example, when n = 3, the name “quartz” has the n-value of 4 because the substrings quartz, uartz, artz, and rtz have at least 3 consecutive consonants each. A greater n-value means a greater social status in the tribe. Two substrings are considered different if they begin or end at a different point (even if they consist of the same letters), for instance “tsetse” contains 11 substrings with two consecutive consonants, even though some of them (like “tsetse” and “tsetse“) contain the same letters.
[Read more…]

Checkout more Interview Questions Tags: Google codejam, Interview, Java, Solved Puzzles

Falling Diamonds Solution: Google codejam 2013 Round 1B

May 5, 2013 by puzzler Leave a Comment

Most of us are familiar with google codejam, those who don’t visit https://code.google.com/codejam for more information. This is the second problem from Online Round 1B 2013, top 1000 from this round will be eligible for next online round.

Problem Statement

Diamonds are falling from the sky. People are now buying up locations where the diamonds can land, just to own a diamond if one does land there. You have been offered one such place, and want to know whether it is a good deal.

Diamonds are shaped like, you guessed it, diamonds: they are squares with vertices (X-1, Y), (X, Y+1), (X+1, Y) and (X, Y-1) for some X, Y which we call the center of the diamond. All the diamonds are always in the X-Y plane. X is the horizontal direction, Y is the vertical direction. The ground is at Y=0, and positive Y coordinates are above the ground.

The diamonds fall one at a time along the Y axis. This means that they start at (0, Y) with Y very large, and fall vertically down, until they hit either the ground or another diamond.

When a diamond hits the ground, it falls until it is buried into the ground up to its center, and then stops moving. This effectively means that all diamonds stop falling or sliding if their center reaches Y=0.

When a diamond hits another diamond, vertex to vertex, it can start sliding down, without turning, in one of the two possible directions: down and left, or down and right. If there is no diamond immediately blocking either of the sides, it slides left or right with equal probability. If there is a diamond blocking one of the sides, the falling diamond will slide to the other side until it is blocked by another diamond, or becomes buried in the ground. If there are diamonds blocking the paths to the left and to the right, the diamond just stops.

falling diamonds problem google codejam round 1b 2013

falling diamonds problem google codejam round 1b 2013

Consider the example in the picture. The first diamond hits the ground and stops when halfway buried, with its center at (0, 0). The second diamond may slide either to the left or to the right with equal probability. Here, it happened to go left. It stops buried in the ground next to the first diamond, at (-2, 0). The third diamond will also hit the first one. Then it will either randomly slide to the right and stop in the ground, or slide to the left, and stop between and above the two already-placed diamonds. It again happened to go left, so it stopped at (-1, 1). The fourth diamond has no choice: it will slide right, and stop in the ground at (2, 0).
[Read more…]

Checkout more Interview Questions Tags: Difficult, Google codejam, Java, Solved Puzzles

Osmos Solution: Google codejam 2013 Round 1B

May 5, 2013 by puzzler Leave a Comment

Most of us are familiar with google codejam, those who don’t visit https://code.google.com/codejam for more information. This is the first problem from Online Round 1B 2013, top 1000 from this round will be eligible for next online round.

Problem Statement

Armin is playing Osmos, a physics-based puzzle game developed by Hemisphere Games. In this game, he plays a “mote”, moving around and absorbing smaller motes.

A “mote” in English is a small particle. In this game, it’s a thing that absorbs (or is absorbed by) other things! The game in this problem has a similar idea to Osmos, but does not assume you have played the game.

When Armin’s mote absorbs a smaller mote, his mote becomes bigger by the smaller mote’s size. Now that it’s bigger, it might be able to absorb even more motes. For example: suppose Armin’s mote has size 10, and there are other motes of sizes 9, 13 and 19. At the start, Armin’s mote can only absorb the mote of size 9. When it absorbs that, it will have size 19. Then it can only absorb the mote of size 13. When it absorbs that, it’ll have size 32. Now Armin’s mote can absorb the last mote.

Note that Armin’s mote can absorb another mote if and only if the other mote is smaller. If the other mote is the same size as his, his mote can’t absorb it.

You are responsible for the program that creates motes for Armin to absorb. The program has already created some motes, of various sizes, and has created Armin’s mote. Unfortunately, given his mote’s size and the list of other motes, it’s possible that there’s no way for Armin’s mote to absorb them all.

You want to fix that. There are two kinds of operations you can perform, in any order, any number of times: you can add a mote of any positive integer size to the game, or you can remove any one of the existing motes. What is the minimum number of times you can perform those operations in order to make it possible for Armin’s mote to absorb every other mote?

For example, suppose Armin’s mote is of size 10 and the other motes are of sizes [9, 20, 25, 100]. This game isn’t currently solvable, but by adding a mote of size 3 and removing the mote of size 100, you can make it solvable in only 2 operations. The answer here is 2.
[Read more…]

Checkout more Interview Questions Tags: Easy, Google codejam, Java, Solved Puzzles

Manage Your Energey Solution: Google codejam 2013 Round 1A

April 27, 2013 by puzzler Leave a Comment

Most of us are familiar with google codejam, those who don’t visit https://code.google.com/codejam for more information. This is the first problem from Online Round 1A 2013, top 1000 from this round will be eligible for next online round.

Problem Statement

You’ve got a very busy calendar today, full of important stuff to do. You worked hard to prepare and make sure all the activities don’t overlap. Now it’s morning, and you’re worried that despite all of your enthusiasm, you won’t have the energy to do all of this with full engagement.

You will have to manage your energy carefully. You start the day full of energy – E joulesof energy, to be precise. You know you can’t go below zero joules, or you will drop from exhaustion. You can spend any non-negative, integer number of joules on each activity (you can spend zero, if you feel lazy), and after each activity you will regain R joules of energy. No matter how lazy you are, however, you cannot have more than E joules of energy at any time; any extra energy you would regain past that point is wasted.

Now, some things (like solving Code Jam problems) are more important than others. For the ith activity, you have a value vi that expresses how important this activity is to you. The gain you get from each activity is the value of the activity, multiplied by the amount of energy you spent on the activity (in joules). You want to manage your energy so that your total gain will be as large as possible.

Note that you cannot reorder the activities in your calendar. You just have to manage your energy as well as you can with the calendar you have.
[Read more…]

Checkout more Interview Questions Tags: Google codejam, Java, medium, Solved Puzzles

Bullseye Solution: Google codejam 2013 Round 1A

April 27, 2013 by puzzler 4 Comments

Most of us are familiar with google codejam, those who don’t visit https://code.google.com/codejam for more information. This is the first problem from Online Round 1A 2013, top 1000 from this round will be eligible for next online round.

Problem

Maria has been hired by the Ghastly Chemicals Junkies (GCJ) company to help them manufacture bullseyes. A bullseye consists of a number of concentric rings (rings that are centered at the same point), and it usually represents an archery target. GCJ is interested in manufacturing black-and-white bullseyes.

Maria starts with t millilitres of black paint, which she will use to draw rings of thickness 1cm (one centimetre). A ring of thickness 1cm is the space between two concentric circles whose radii differ by 1cm.

Maria draws the first black ring around a white circle of radius r cm. Then she repeats the following process for as long as she has enough paint to do so:

  1. Maria imagines a white ring of thickness 1cm around the last black ring.
  2. Then she draws a new black ring of thickness 1cm around that white ring.

Note that each “white ring” is simply the space between two black rings.

The area of a disk with radius 1cm is π cm2. One millilitre of paint is required to cover area π cm2. What is the maximum number of black rings that Maria can draw? Please note that:

  • Maria only draws complete rings. If the remaining paint is not enough to draw a complete black ring, she stops painting immediately.
  • There will always be enough paint to draw at least one black ring.

[Read more…]

Checkout more Interview Questions Tags: Google codejam, Interview, Java, Solved Puzzles

Fair and Square Solution: Google codejam 2013 Qual Round

April 14, 2013 by puzzler Leave a Comment

Most of us are familiar with google codejam, those who don’t visit https://code.google.com/codejam for more information. This is the third problem from Qualification Round 2013.

Problem Statement

Little John likes palindromes, and thinks them to be fair (which is a fancy word for nice). Apalindrome is just an integer that reads the same backwards and forwards – so 6, 11 and 121 are all palindromes, while 10, 12, 223 and 2244 are not (even though 010=10, we don’t consider leading zeroes when determining whether a number is a palindrome).

He recently became interested in squares as well, and formed the definition of a fair and square number – it is a number that is a palindrome and the square of a palindrome at the same time. For instance, 1, 9 and 121 are fair and square (being palindromes and squares, respectively, of 1, 3 and 11), while 16, 22 and 676 are not fair and square: 16 is not a palindrome, 22 is not a square, and while 676 is a palindrome and a square number, it is the square of 26, which is not a palindrome.

Now he wants to search for bigger fair and square numbers. Your task is, given an interval Little John is searching through, to tell him how many fair and square numbers are there in the interval, so he knows when he has found them all.
[Read more…]

Checkout more Interview Questions Tags: Difficult, Google codejam, Interview, Java, Solved Puzzles

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next Page »
Submit your Puzzle

You may also like

  • Charging Chaos Solution – Google CodeJam
  • Dead Pixels solution: Facebook hacker cup 2013 Round 1
  • Sort the array in O(N)
  • Spinning Disc Direction Puzzle
  • Output of the recursive program
  • Detect if there is a cycle in a linked list
  • Consonants Solution: Google codejam 2013 Round 1C
  • 2nd smallest number from 32 numbers
  • Osmos Solution: Google codejam 2013 Round 1B
  • Objective Questions set C/C++ – Part 5

Categories

  • Aive hi Puzzles
  • Akbar and Birbal
  • Alphabetical Puzzles
  • Bollywood Puzzles
  • Google Code jam
  • Hindi Riddles
  • Interview Puzzles
  • Interview Questions
  • Logical Puzzles
  • Malayalam Puzzles
  • Maths Puzzles
  • Miscellaneous
  • Number Puzzles
  • Picture Puzzles
  • Riddles
  • Tamil Puzzles
  • Technical

Social

  • View puzzlersworld’s profile on Twitter
privacy policy

Copyright © 2025 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in

  • Hacker Puzzle
  • Logo Puzzles
  • Optical Illusions
  • WhatsApp Puzzles
  • Picture Puzzles
  • Riddles
    ▼
    • Hindi Riddles
  • Bollywood Puzzles
  • Alphabetical Puzzles
  • Aive hi Puzzles
  • Interview Puzzles
  • Logical Puzzles
  • Interview Questions
    ▼
    • Data Structures
    • Binary Tree
    • Algorithms
    • Recursion Questions
    • Amazon Interview Questions
    • Snapdeal Interview Questions
    • Google Code jam
  • Technical
  • Akbar and Birbal
  • Number Puzzles
  • Maths Puzzles
  • Miscellaneous