"I want to ask a question" - Ask them all here!

Could’nt find the question of my type

Can u Tell where my code fails pls, I have’nt got any test-case error when I tried from my side.

Anyways, coming to the error, the scores per round are CUMULATIVE scores instead of individual scores. Meaning, New score= sum of score of all rounds till now. Lead and difference are calculated on this one.

Try to search better, because this question is so commonly asked, I think you are doing some mistake while searching.

ty, finally got that :slight_smile:

Did you check the editorial?

Probably no… You want me to upgrade this to a question?

Why Binary search? Just make an array which has all the distances upto {10}^{9} and iterate through it to find the closest possible distance. Use it in formula for the answer.

I will upgrade it to a question once you add more details of your approach.

If you are to use binary search only you can refer my solution. I used std::lower_bound instead of hard-coding binary search.

Already forwarded to @admin yesterday. They are looking into the issue. Thanks for reporting though :slight_smile:

@vijju123 I think that my approach is the most optimal approach. I calculate everything in O(1) tc and find the sum of n numbers <= N in Log(n) tc and O(1) spaceC . I did as everyone. my logic was correct.(atleset i thougt so )
So i needed to know where it fails .

@divik you used a Dp approach , i think . but I used BS to find the sum of natual numbers; less than equal to given N.
your appraoch is different than mine.

Can you give the reference link?

question link please.

Its a standard question “Merge k sorted list/arrays”. Did you refer to geeksforgeeks code for comparison?

@vijju123, I have updated the post with problem link, please check.
And sorry about multiple revisions/edits, I tapped “Save edit” again and again because the site wasn’t loading quickly

I found the bug in my code. Now it gives TLE. At worst case, time complexity becomes linear when lower_bound finds an already assigned apartment. Here’s my code : 38QCMR - Online C++0x Compiler & Debugging Tool - Ideone.com

Can you elaborate the 2 pointer approach ?

Edited your comment @aryanc403 . Have a look for any corrections.

@aryanc403 Thanks for all your help.

Its taking time because of verification of 100% attendance laddus in my opinion. You will get them, just wait a few more days. Will ping @admin if you dont receive them after 2 days. Ok? :slight_smile:

import java.util.*;
public class ReverseNumber {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	Scanner sc = new Scanner(System.in);
		
		int times = sc.nextInt();
		for(int i=0;i<times;i++)
		{
			String s1= sc.next();
			StringBuilder sb = new StringBuilder(s1);
			sb.reverse();
		}	System.out.println(sb);

}

}
This is my solution @aryanc403, Thanks in advance :slight_smile: