We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Warmup
- Compare the Triplets
- Discussions
Compare the Triplets
Compare the Triplets
Sort by
recency
|
4371 Discussions
|
Please Login in order to post a comment
Great explanation of the algorithm! I’ve always been interested in understanding algorithm efficiency, especially when working with real-world data. I’m also working on a project where I use efficient data structures to categorize and sort menu pricing data. If anyone is interested in fast lookup operations, you can check out my project here: https://mcdonaldmenuprices.com/”
Here's my solution in Python 3: (Any improvements are welcome)
public static List compareTriplets(List a, List b) { List result=new ArrayList<>(); int sum=0; int sum1=0; int sum2=0; int sum3=0; for(int i=0;ib.get(i)){ sum1=sum1+1; result.add(sum1); }
else if(a.get(i)b.get(j)){ sum2= sum2+1; result.add(sum2); } else if(a.get(j)