PuzzlersWorld.com

  • Hacker Puzzle
  • Interview Puzzles
  • Number Puzzles
  • Maths 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

Decode Happy

April 11, 2013 by puzzler 3 Comments

IF FMJNT and FWPM are the code of SMILE and LOVE resptively. What will be the code of HAPPY?
A) IBTWM
B) QJATB
C) ZQQBI
D) TNJMP

picture puzzle: decode-happy

picture puzzle: decode-happy

Check your answer: Enter A, B, C or D

Tried enough already?

[Read more…]

Checkout more Picture Puzzles Tags: Difficult, Puzzle, Solved Puzzles

Sort the array in O(N)

April 11, 2013 by puzzler 1 Comment

Problem Statement
Given an integer array of length N, containing values in the range 1,2,3…N^2. Sort the array in O(N) time.

Solution
[Read more…]

Checkout more Interview Questions Tags: Algorithm, Array, Difficult, Interview, Java, Solved Puzzles

Find a pythagorean triplet from an array

March 28, 2013 by puzzler 1 Comment

Problem Statement:
Given an array a of n integers find all possible Pythagorean triplets from the array.

What is Pythagorean triplet?

A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2. this formula is derived from Pythagoras theorem: “For every right angle triangle with side lengths a, b, and c=> a2 + b2 = c2“.

Pythagorean Triplet

Pythagorean Triplet

Solution:
[Read more…]

Checkout more Interview Questions Tags: Algorithm, Array, Difficult, Interview, Solved Puzzles

3 SUM problem

March 27, 2013 by puzzler Leave a Comment

Problem Statement:
Given a set S of n integers find all possible subsets(a,b,c) such that a + b + c = 0.

Solution:
Brute force approach is of O(n^4) but we can solve it in O(n^2) by using the approach in Non duplicate pairs that sum to S.

First sort the array(Order O(nlogn)), than finding a, b, c pairs is equal to finding=> For every element a in the array, if there exists a pair with sum equal to -a. As explained in Non duplicate pairs that sum to S, we can get the pair with sum -a in O(n) and we have to repeat this exercise n times so order of complexity will be O(n^2).

Checkout more Interview Questions Tags: Algorithm, Array, Difficult, Interview, Solved Puzzles

Number Puzzle #26

March 27, 2013 by puzzler Leave a Comment

 

Find the missing number

Find the missing number

This puzzle is courtesy , shared on puzzlersworld facebook page.
See AnswerHide Answer

Answer is 2

How?
7*6 = 4 2
9*9 = 8 1
5*3 = 1 5
6*2 = 1 2

Checkout more Number Puzzles Tags: Difficult, Number, Puzzle, Solved Puzzles

Number Puzzle #21

March 20, 2013 by puzzler Leave a Comment

 

number puzzle 21

number puzzle 21

See AnswerHide Answer

Answer is 14

Checkout more Number Puzzles Tags: Difficult, Number, Puzzle, Solved Puzzles

Picture puzzle – Circle, dot and line

March 8, 2013 by puzzler 4 Comments

What should be the next circle ?

picture puzzle - circle dot and line

picture puzzle – circle dot and line

See AnswerHide Answer
Frankly speaking i don’t have any solid reason to choose an option, i think there can be more then one answer with different explanations.

I am looking for the perfect answer for this one, so if you know, please put your answer with reason in the comment box below 🙂

Checkout more Picture Puzzles Tags: Difficult, Puzzle, Solved Puzzles

RoboElection solution: Facebook hacker cup 2013 Round 2

February 16, 2013 by puzzler 1 Comment

From 2011 facebook is organizing a Facebook hacker cup every year around feb, visit Facebook hacker cup homepage for more details

This question is the second question(Carried 35 marks out of 100) for the Round 2 of 2013 hacker cup. only top 100 contestants will be moved to Round 3.

Problem Statement

In the not so distant future the world is populated by robots and ruled by an evil robot emperor. Every robot in the world can be identified by a unique numeric ID, and the list of all the existing robot IDs is easily accessible to everyone. One day the emperor decided to call for a general election to preserve an illusion of democracy. He set it up in the following way:

  • – Every robot can cast at most one vote per round of voting and the votes are anonymous.
  • – The only option on the ballot is the vote for reelection of the emperor.
  • – If at least P percent of the population cast votes for the emperor he becomes reelected for the next millennium.
  • – Otherwise the emperor declares the vote void, disassembles K robots with the lowest ID numbers (who he finds to be the most rebellious), and then if there are any functional robots left he restarts the whole process.

All the robots are perfectly logical but also rather lazy and prone to procrastination. That’s why after figuring out the plan of the emperor, they will abstain from voting unless they have to vote to survive the election (including this round and all later rounds). If they will die whether or not they vote, they will vote in the hope that the emperor will spare them. (He won’t, because he’s evil!).

Problem

Given N – the initial population size, K – the number of robots disassembled after an unsuccessful vote and P – the required percentage of votes.

Compute the number of times the vote will take place.
[Read more…]

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

Dead Pixels solution: Facebook hacker cup 2013 Round 1

February 8, 2013 by puzzler Leave a Comment

From 2011 facebook is organizing a Facebook hacker cup every year around feb, visit Facebook hacker cup homepage for more details

This question is the third question(Carried 45 marks out of 100) for the Round 1 of 2013 hacker cup. only top 500 contestants will be moved to Round 2.

Problem Statement

John’s friend Peter purchases a new high resolution monitor with dimension W * H where W is the number of pixels in each row (i.e. width) and H is the number of pixels in each column (i.e. height).

However, there are N dead pixels on the monitor. The i-th dead pixel is located at (x[i], y[i]). (0, 0) is the top-left pixel and (W – 1, H – 1) is the bottom-right pixel. The locations of the dead pixels could be generated by 6 given integers X, Y, a, b, c and d by the following rules. If 2 pixels are at the same location, they are considered the same. It is possible that there are less than N distinct dead pixels.

  • x[0] = X
  • y[0] = Y
  • x[i] = (x[i – 1] * a + y[i – 1] * b + 1) % W (for 0 < i < N)
  • y[i] = (x[i – 1] * c + y[i – 1] * d + 1) % H (for 0 < i < N)

Peter connects his monitor to his computer and opens an image with dimension P (width) * Q (height). How many unique positions can the image be placed so that it can be displayed perfectly (i.e. all pixels of the picture are shown on the monitor)? The image cannot be rotated.
[Read more…]

Checkout more Interview Questions Tags: Algorithm, Difficult, Facebook Hacker Cup, Interview, Java, Solved Puzzles

  • « Previous Page
  • 1
  • …
  • 5
  • 6
  • 7
  • 8
  • 9
  • …
  • 12
  • Next Page »
Submit your Puzzle

You may also like

    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