All Questions
92
questions
-1
votes
2
answers
83
views
Making 24 with given number N
Initially we have a sequence of n integers: 1, 2, ..., n. In a single step, we can pick two of them, let's denote them a and b, erase them from the sequence, and append to the sequence either a + b, ...
-1
votes
1
answer
373
views
Finding winner of flipping game
Alice and Bob play a game with N non-negative integers.
Players take successive turns, and in each turn, they are allowed to flip active bits from any of the integers in the list.
That is, they ...
0
votes
1
answer
141
views
Count numbers with prime digit
Given a number $N$, I need to find the count of the numbers that have atleast one prime digit $2,3,5$ or $7$ in it.
Now $N$ can be upto $10^{18}$. What is the best approach to solve this problem.
...
2
votes
0
answers
127
views
Integer partitions without rotated solutions?
I'm searching for an algorithm to determine a list of all integer partitions of a number $n$ into a fixed number $m$ of summands (say $n=6$ and $m=4$), for instance to be stored into a list of (...
0
votes
0
answers
312
views
Cleaning minimum tables
John has been newly hired to clean tables at his restaurant. So whenever a customer wants a table, he must clean it.
But John happens to be a lazy boy. So in the morning, when the restaurant is ...
0
votes
0
answers
600
views
Count arrangment such that each person wear different tshirt
Few friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts ...
2
votes
2
answers
3k
views
Flip cards to get maximum sum
Given N cards where if ith card has number x on its front side then it will have -x on back side and a single operation that can be done only once that is to flip any number of cards in consecutive ...
1
vote
1
answer
104
views
Find extra work done by Bob
Alice has challenegd Bob game of N puzzle.N puzzle is played on N*N grid with each cell containing distinct numbered tile from 1 to N*N-1 Except one which is empty cell and represented as 0.
Move ...
0
votes
1
answer
2k
views
Number of ways to win chocolate game
Alice and Bob are playing a game. They have N containers each having one or more chocolates. Containers are numbered from 1 to N, where ith container has A[i] number of chocolates.
The game goes like ...
2
votes
2
answers
3k
views
Finding Coprime triplets
Given a sequence a1, a2, ..., aN. Count the number of triples (i, j, k) such that 1 ≤ i < j < k ≤ N and GCD(ai, aj, ak) = 1. Here GCD stands for the Greatest Common Divisor.
Example : Let N=4 ...
3
votes
1
answer
93
views
Number of ways to color such that one color always leads
There are n boxes drawn out in a line. We have two colors, blue and red. We start coloring boxes from left to right. At any instant we want to color the boxes in such a way that number of boxes ...
1
vote
2
answers
739
views
Game of cards and GCD
Alice and Bob play the game. The rules are as follows:
Initially, there are n cards on the table, each card has a positive integer written on it.
At the beginning Alice writes down the number 0 on ...
0
votes
1
answer
148
views
Count Integers satisfying the conditions
Given some constraints ,I need to find possible ways that these conditions are satisfied.
I need to find four POSITIVE integers a,b,c,d such that ad-bc > 0 and also a+d=N for a given value of N.
How ...
6
votes
1
answer
749
views
Count expressions with 1s and 2s
Given at most X number of 1s and at most Y number of 2s. How many different evaluation results are possible when they are formed in an expression containing only addition + sign and multiplication * ...
0
votes
1
answer
87
views
Number of ways to make grid
I need to construct a L x 3 grid as shown below
But i can use only two shapes to make it which are :
Here L is the number of small square boxes in each row. I can rotate the shapes as I want. I ...