PuzzlersWorld.com

  • Hacker Puzzle
  • Interview Puzzles
  • Number Puzzles
  • Maths Puzzles

Security problem solution: Facebook hacker cup 2013 Round 1

February 4, 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 second question(Carried 35 marks out of 100) for the Round 1 of 2013 hacker cup. only top 500 contestants will be moved to Round 2.

Problem Statement

You are designing a new encryption system that works in the following way:

For server-client communication you need a key k, composed of m sections, each of length l, and the key consists only of lowercase characters in the set {a, b, c, d, e, f}. The server has a key k1 and the client has a key k2 where:

  • k1 = f(k). f is a function that receives a key and replace some random letters by ? indicating that those characters can be any lowercase letter of the set described before.
  • k2 = f(g(k)). g is a function that takes a key and produces a random permutation of its m sections. And f is the function defined above.

For example: let m = 3, l = 2

  • f(‘abacbc’) = ‘?ba??c’
  • g(‘abacbc’) = ‘acbcab’ (each section was moved one place to the left).

Your task is given k1 and k2, find key k. If there are several solutions, print the lexicographically smallest key. And if there is no solution at all, print “IMPOSSIBLE” (without the quotes).

Input description:

[Read more…]

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

Balanced Smileys solution: Facebook hacker Cup 2013 Qual Round

January 29, 2013 by puzzler 4 Comments

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 qualification round 2013 hacker cup.

Problem Statement

Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to express himself through emoticons, he hates unbalanced parenthesis so much that it makes him go 🙁

Sometimes he puts emoticons within parentheses, and you find it hard to tell if a parenthesis really is a parenthesis or part of an emoticon.

A message has balanced parentheses if it consists of one of the following:
[Read more…]

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

Find all non duplicate pairs that sum to S

January 25, 2013 by puzzler Leave a Comment

Find all non duplicate pairs that sum to S.

try to do it in O(nlogn).

Solution 1:
[Read more…]

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

Days of month using 2 dice

January 24, 2013 by puzzler 8 Comments

How can you represent days of month using two 6 sided dice ?

You can write one number on each face of the dice from 0 to 9 and you have to represent days from 1 to 31, for example for 1, one dice should show 0 and another should show 1, similarly for 31 one dice should show 3 and another should show 1.

represent days of month using two dice

represent days of month using two dice

See AnswerHide Answer
Answer is:
Dice 1: 0 1 2 3 5 7
Dice 2: 0 1 2 4 6 8

How?
Basically you have to show 11, 22 so 1 and 2 should be present in both dices, similarly to show 01, 09 0 should be present in both dices, now the trick is for showing 9 you can use dice with 6 printed on one of the face.

Checkout more Interview Puzzles Tags: Dice, Difficult, Interview, Puzzle, Solved Puzzles

Guess the movie names

January 21, 2013 by puzzler 10 Comments

Guess the movie names from WhatsApp Emoticons and smileys

guess the movie names from the picture

guess the movie names from the picture

Guess the movie names in above image

[Read more…]

Checkout more Picture Puzzles Tags: Difficult, Guess the Movie Names, Solved Puzzles, WhatsApp Emoticons

Number Puzzle #13

January 20, 2013 by puzzler Leave a Comment

 

IF  1 = 3 2 = 3 3 = 5 4 = 4 5 = 4 then 6 = ?

IF
1 = 3
2 = 3
3 = 5
4 = 4
5 = 4
then 6 = ?

See AnswerHide Answer

Answer with Explanation

Answer is 3.
How?
It simple, but you have to think more then the math 🙂
1 = one = 3 letters
2 = two = 3 letters
3 = three = 5 letters
4 = four = 4 letters
5 = five = 4 letters
6 = six = 3 letters

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

Number Puzzle #12

January 20, 2013 by puzzler 1 Comment

 

64 5 40 81 7 65 16 4 ?

64 5 40
81 7 65
16 4 ?

See AnswerHide Answer

Answer with Explanation

Answer is 16.
How?
Its a little trickier one then others.
sqr root(64) * 5 = 40
sqr root(81) * 7 = 63
sqr root(16) * 4 = ? = 16.

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

How many triangles #7

January 20, 2013 by puzzler 1 Comment

1.) How many triangles are there in this hexagon?

how many triangles in this hexagon

how many triangles in this hexagon

Answer with solution

Again it is good to use symmetry here, we can brake this image into six small triangles each formed by one of the side of the hexagon and each of the triangle is divided in half by a line. we will count the number of triangles formed by each part and by taking two or more such parts together.

Number of triangles formed by one part: 3 so total 3*6 = 18.
Number of triangles formed by taking two adjacent parts together: 2*3(three such cases as for 3 cases it is zero) so total 6.
Number of triangles formed by taking three adjacent triangles: 2*6 ( for each case 2 triangles are possible) so total 12
Number of triangles formed by taking 4 or 5 parts together: 0
Number of triangles formed by taking all 6 parts together: 1

Thus, total number of triangles possible in above puzzle are: 18+6+12+1= 37

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

Four How many triangles puzzle?

December 29, 2012 by puzzler 16 Comments

1.) How many triangles are in this picture ?

how many triangles are there in this picture

how many triangles are there in this picture

See AnswerHide Answer

There are a total of 20 triangles.

How?
Lets count…
Assuming smallest side of a triangle is 1 cms.
Number of triangles with side 1 cms: 12(1 + 5 + 5 +1)
Number of triangles with side 2 cms: 6(1 + 2(triangles facing upward), 1+2(triangles facing downward))
Number of triangles with side 3 cms: 2(1 triangle facing upward and 1 facing downwards).

Thus, total number of triangles are 20.

2.) How many triangles are in this picture ?

[Read more…]

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

Rotate an array by k elements

November 18, 2012 by puzzler Leave a Comment

Given an array of n elements, write an algorithm to rotate it right by k element without using any other array. In other words rotate an array in place.
you can have temp variable to swap two elements.
Ex:-
Initial Array: A = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Rotating array A right by 3 elements should result in
A = {8, 9, 10, 1, 2, 3, 4, 5, 6, 7}
Hint: There is a trick, think before doing much of the programming 🙂
See Solution: Rotate an array by k elementsHide Solution

So the trick is to reverse the whole array first then reverse the array from 0 to k-1 and k to n-1.
For example
Array A after reversing whole array: {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}
Array A after reversing 0 to 2 elements: {8, 9, 10, 7, 6, 5, 4, 3, 2, 1}
Array A after reversing 3 to 9 elements: {8, 9, 10, 1, 2, 3, 4, 5, 6, 7}
Code:

void rotateRight(int[] a, int k){
	int length = a.length();//in C/C++ it will be given as input
	reverse(a, 0, length -1);//reverse whole array
	reverse(a, 0, k-1);//assuming 0 < k < length
	reverse(1, k, n-1);
}
void reverse(int[] a, int start, int end){
	while(start < end){
		swap(a, start, end);
		start++;
		end--;
	}
}
void swap(int[] a, int pos1, int pos2){
	int temp = a[pos1];
	a[pos1]= a[pos2];
	a[pos2] = temp;
}
//Note: in interviews you might be asked to handle negative scenarios
// like array out of bound etc.

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

  • « Previous Page
  • 1
  • …
  • 6
  • 7
  • 8
  • 9
  • 10
  • …
  • 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