Pregunta de entrevista de Tiger Analytics

How to reverse strings with changing Position - Answered

Respuestas de entrevistas

Anónimo

30 abr 2017

If two squares are chosen at random on a chessboard, what is the probability that they have a side in common? - Did't answer Answer - The corner squares are the ones. There are 4 such squares. P(selecting such a square) = 4/64 Here also, let the event of selecting an adjacent square be C, P(C)= 2/63 Now, solving all the three cases and adding them will give us the answer. Answer: P(selecting a square adjacent to 4 squares)*P(A) + P(selecting a square adjacent to 3 squares)*P(B) + P(selecting a square adjacent to 2 squares)*P(C) (36/64)*(4/63) + (24/64)*(3/63) + (4/64)*(2/63) 1/18

7

Anónimo

22 jul 2019

While reversing the string. We start the loop from the initial value to the half of the string length then choose the first value and last values. Swap both the values.

1

Anónimo

21 may 2020

Total number of pairs on a chessboard = 64C2 Number of adjacent pairs = (7*8)*2 - (explanation: Every column has 7 adjacent pairs, there are 8 columns, similarly for rows) Answer = (7*8*2)/(64C2) = 1/18

2