+ 1

Triplets b/w L to R with minimal time complexity i.e, o () < o (n^3)

I need to find the triplets b/w L to R (eg. L=1, R = 2 then triplets will be (1,1,1),(1,1,2),(1,2,1),(2,1,1),(2,1,2).. and so on. I can do this by 3 nested loop but i want to do it optimally

28th Dec 2018, 11:40 AM
Akshay
Akshay - avatar
1 Antwort
+ 2
Hello How about this solution? I think it satisfies your time complexity requirement. It can be simplified further but I kept the binary list for demonstration purpose. https://code.sololearn.com/cnemSZrpb4q5/?ref=app
10th Jan 2019, 5:41 PM
Tibor Santa
Tibor Santa - avatar