Accenture Interview Question
Developer Program EngineersCountry: United States
Interview Type: Written Test
you can iterate through the list one checking inadvance with its 3 successor in the list.
if both consecutive it same, then you can discard this, similarly if three consecutive is incremental then discard them.
if you find 'A', then replace with the previous card and assume that can be discarded.
this can be done in O(n). just one iteration of the list.
Can the following be a case: 2,2,2,3,4,6,7,8,9,9,9,10,A?
- Pooja Basia September 26, 2013Highlighted points:
1. '5' is missing .
2. If we discard (2,2,2) then it would return false. Even if 'A' is converted into '5'.
Alternatively, If we discard (2,2) and then (2,3,4) , then it would return true.