Ceil in Java

Revision en1, by priyansh_max, 2025-06-10 15:13:50

I am a bit confused here what's the difference? given--> (1 ≤ n ≤ 10^18)

Approach — 1 long min = n/6+(n % 6 > 0 ? 1 : 0);

Approach — 2 long min = (long)Math.ceil((n * 1.0)/6);

Approach — 1 passed all the test cases

Approach — 2 failed on large values of n

Tags doubt, confusion

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English priyansh_max 2025-06-10 15:13:50 318 Initial revision (published)