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…]
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…]
IF: 111 = 13
112 = 24
113 = 35
114 = 46
115 = 57
Then: 117 = ?
How?
Answer is in this format : <last digit><sum of all digits>
thus answer to this number puzzle will be 79.
IF 1 + 4 = 10
2 + 8 = 20
4 + 16 = 40
then, 8 + 32 = ?
How?
Sum multiplied by 2.
What is the missing number ?
How?
72/18 = 4
95/19 = 5
missing number should be 84/14 = 6.
how many squares puzzle
How?
Let say smallest square is of side 1cms then
Number of squares with side 1cms: 6
Number of squares with side 2cms: 8
Number of squares with side 3cms: 2
Number of squares with side 4cms: 1
2 6 3 ?
80 24 120 36
How?
number on the right side of the box is the multiple of the first digit on the left side and 3.
25 15
100
59 ?
Sum of all 4 outer box is 100
IF 1 + 1 = 5
2 + 2 = 20
3 + 3 = 45
Then, 4 + 4 = ?
How?
Multiply the two numbers and then multiply the result by 5.
16, 43, 27
11, 36, 25
29, 56, ?
How?
Number in middle column is sum of the respective numbers in first and third column. thus the missing number should be 56 – 29 = 27.
Problem Statement:
Given an array a of n integers find all possible Pythagorean triplets from the array.
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
Solution:
[Read more…]