0% found this document useful (0 votes)
22 views1 page

Coding Challenges for Programmers

The document contains 4 questions related to coding problems: 1) Write code to traverse and print the values of a binary tree in a specific order. 2) Find the minimum number of platforms required for a train station given arrival and departure times. 3) Find all leader elements in an array, where a leader is an element greater than all elements after it. 4) Determine the element at a given position in an expanded string without fully expanding a compressed string where numbers indicate repeats of previous characters.

Uploaded by

Vishnu Poddar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

Coding Challenges for Programmers

The document contains 4 questions related to coding problems: 1) Write code to traverse and print the values of a binary tree in a specific order. 2) Find the minimum number of platforms required for a train station given arrival and departure times. 3) Find all leader elements in an array, where a leader is an element greater than all elements after it. 4) Determine the element at a given position in an expanded string without fully expanding a compressed string where numbers indicate repeats of previous characters.

Uploaded by

Vishnu Poddar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Question

1
Given a general Binary tree. for eg

1
/

2 3
/ \ / \
4 5 6 7
/ \
8 9
Write code to print the traversal: 8,9,4,5,6,7,2,3,1 .
Question 2
Given a list of arrival and departure times(as pairs) for train, sorted by the arrival times. Find the
minimum number of platforms required.
Question 3
Find all the leaders in an Array. An array element is Leader if all the elements following it are
lesser than or equal to it. e.g. Arr= {13,17,5,4,6,2} Output: 17,6,2
Question 4
A encoded/shortened string is given. You have to tell the element at kth position in the
expanded string without actually expanding the string. In the encoded string if you find any
number then the previously expanded string repeats that many times.
e.g. Encoded string : ab2ac3 k = 10 Expanded string : ababacababacababac Answer : a

You might also like