My solution is O(n) and I can prove it. All tests from forum were successfully passed. Solution's body is 31 strings (without var declaratoins, etc.) and I am looking for mistakes more than an hour. So I suppose, there is no bug..(
But I have WA5. Mabe some incorrect input ? Or some thing I didn't notice ? If u have got any idea or maybe test, please, help..