Amazon OA Questions
Anonymous User
2175

Q1. https://leetcode.com/problems/reorder-data-in-log-files/

Q2. Given a string consisting of 0's and 1's, find the number of ways to select 3 characters, such that they are in ascending order (index wise) and no two adjacent selected characters are same.
Example: s = "01001"
these are ways:
(010 ) -> 010,
(01 0 ) -> 010 ,
( 10 1) -> 101,
( 1 01) -> 101

here space means, we omitting a character from the original string (01001).

answer: 4

In solving the q2, I got TLE. My solution was able to solve 7/14 testcases.
Do I have a chance for the next round?

Comments (6)