GeeksforGeeks
yesterday at 19:03. Facebook
[ Geeksforgeeks.org Link ]
Given two arrays of integers of size m and n where m n. We need to maximize the dot product by inserting zeros in the second array but we cannot disturb the order of elements.

Input : A[] = {2, 3 , 1, 7, 8}
B[] = {3, 6, 7}
Output : 107
Explanation : We get maximum dot product after
inserting 0 at first and third positions in
second array.
Maximum...
View details ⇨

Find Maximum dot product of two arrays with insertion of 0's - GeeksforGeeks

geeksforgeeks.org
GeeksforGeeks
yesterday at 17:24. Facebook
[ Geeksforgeeks.org Link ]
Given an NxN chessboard and a Knight at position (x,y). The Knight has to take exactly K steps, where at each step it chooses any of the 8 directions uniformly at random. What is the probability that the Knight remains in the chessboard after taking K steps, with the condition that it can’t enter the board again once it leaves it.

Probability of Knight to remain in the chessboard - GeeksforGeeks

geeksforgeeks.org
GeeksforGeeks
yesterday at 16:50. Facebook
GeeksforGeeks
yesterday at 04:54. Facebook
[ Geeksforgeeks.org Link ]
Input : n = 54
Output : 232
Divisors of 54 = 1, 2, 3, 6, 9, 18, 27, 54.
Sum of divisors of 1, 2, 3, 6, 9, 18, 27, 54
are 1, 3, 4, 12, 13, 39, 40, 120 respectively.
Sum of divisors of all the divisors of 54 =
1 + 3 + 4 + 12 + 13 + 39 + 40 + 120 = 232.

Input : n = 10
Output : 28
Divisors of 10 are 1, 2, 5, 10
Sums of divisors of divisors are
1, 3, 6, 18.
Overall...
View details ⇨

Find sum of divisors of all the divisors of a natural number - GeeksforGeeks

geeksforgeeks.org
GeeksforGeeks
01/20/2017 at 15:55. Facebook
[ Geeksforgeeks.org Link ]
Many programmers always argue that the problems in Competitive Programming always end up with TLE(Time Limit Exceed). The Main problem of this error is that it will not allow you to know that your solution would reach to correct solution or not!

How to overcome Time Limit Exceed(TLE)? - GeeksforGeeks

geeksforgeeks.org
GeeksforGeeks
01/20/2017 at 11:36. Facebook
[ Geeksforgeeks.org Link ]
Input : str1 = "geeks"
str2 = "geeksfor"
str3 = "geeksforgeeks"
Output : 5
Longest common subsequence is "geeks"
i.e., length = 5

Input : str1 = "abcd1e2"
str2 = "bc12ea"
str3 = "bd1ea"
Output : 3
Longest common subsequence is "b1e"
i.e. length = 3.

LCS (Longest Common Subsequence) of three strings - GeeksforGeeks

geeksforgeeks.org
GeeksforGeeks
01/20/2017 at 03:00. Facebook
[ Geeksforgeeks.org Link ]
Given three numbers x, y and k, find the k’th common factor of x and y. Print -1 if there are less than k common factors of x and y.
Examples:

Input : x = 20, y = 24
k = 3
Output : 4
Common factors are 1, 2, 4, ...

Input : x = 4, y = 24
k = 2
Output : 2

Input : x = 22, y = 2
k = 3
Output : -1

Print the kth common factor of two numbers - GeeksforGeeks

geeksforgeeks.org