John Wick's Profession: Hint

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

John Wick's profession

John Wick has lost his memory in a car accident, sadly. But there is one help you can
do for John Wick. Help him recall who he is.

Hint:
If you get more 1's than 0's, John Wick is a doctor.

If you get more 0's than 1's, John Wick is a plumber.

If you get equal number of 1's and 0's, John Wick is a carpenter.

function foo()

print 1

function soo()

print 0

function zoo()

foo()

soo()

function koo()

foo()

soo()

soo()

function loo()

foo()

foo()

soo()
If the functions run in the following order, tell who is John Wick?

koo(), foo(), loo(), foo(), zoo(), foo(), soo(), soo(), soo()

John Wick is a carpenter.

John Wick is a doctor.

I am unable to help John Wick.

John Wick is a plumber.

unanswered

Submit

You have used 0 of 1 attemptSome problems have options such as save, reset, hints, or show answer.
These options follow the Submit button.

Round and round


We have come upon a 'longRunning' method in our code. In order to check its lengthy
execution time, we are calculating its iterations it against different inputs.

Can you figure out the number of iterations it will take to execute the following input:

[1, 15, 1, 3, 18, 3]

function longRunningFunction(array) {
for ( i = 0; i < length(array); i++ ) {
idx = i
for ( j = i + 1; j < length(array); j++ ) {
if ( array[idx] > array[j] ) {
idx = j
}
}
swap( array[i], array[idx] )
}
}

-1
5

unanswered

Submit

You have used 0 of 1 attemptSome problems have options such as save, reset, hints, or show answer.
These options follow the Submit button.

Binary Tree Traversal


What is the post-order traversal of the following binary tree?

SBVDFAY

Answer (e.g. ARBISOFT)   unanswered 

Submit
You have used 0 of 1 attemptSome problems have options such as save, reset, hints, or show answer.
These options follow the Submit button.

The queue and the stack


Consider a circular queue and a stack of size 5 and 7 respectively. Circular queue also
performs following operations:

1. After Enqueue(x):

o Push(x)

o Push(x mod 3)
2. After x = Dequeue():
o y = Pop()

o Push(x + y)

What will be the representation of stack after performing following operations:

en
enq de enq enq enq de de enq
qu
ueu qu ueu ueu ueu qu qu ueu
eu
e(1 eu e(1 e(1 e(1 eu eu e(1
e(5
7) e() 1) 9) 5) e() e() 4)
)

[5, 7, 19, 9, 13, 7, 49]

None of the above

[5, 17, 11, 19, 15, 14]

[5, 5, 18, 8, 12, 5, 48]

[5, 2, 17, 7, 11, 2, 47]

unanswered

Submit

You have used 0 of 1 attemptSome problems have options such as save, reset, hints, or show answer.
These options follow the Submit button.

Novel Arrangement
Anaya has three Urdu novels (G, A, D) and Four English novels (C, B, E, F). She wants
to arrange her novels in a way that following conditions must be met:
- No english novel can be placed immediate after another english novel.

- D must be placed earlier than E.

- B and E must be separated from each other by at least one novel.

- B must be placed immediately before or after G.

- G must be placed immediately after C, but not if A is placed earlier than C.

Choose the best sequence of novels:

C, D, F, A, B, G, E

A, D, B, F, E, G, C

F, A, C, D, B, G, E

E, G, B, D, F, A, C

unanswered

Submit

You have used 0 of 1 attemptSome problems have options such as save, reset, hints, or show answer.
These options follow the Submit button.

You might also like