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
- Data Structures
- Trees
- Square-Ten Tree
- Discussions
Square-Ten Tree
Square-Ten Tree
Sort by
recency
|
38 Discussions
|
Please Login in order to post a comment
public class Solution { public static void main(String[] args) { /* Read and save input */ Scanner scan = new Scanner(System.in); String strL = new BigInt(scan.next()).subtract(BigInt.ONE).toString(); // subtract 1 since it's [L,R] inclusive String strR = scan.next(); scan.close();
}
// - Java's BigInteger is not fast enough to pass the testcases. The BigInt I create below is more efficient for this problem. // - This link has good implementation ideas (Though they store numbers in reverse order): // http://iwillgetthatjobatgoogle.tumblr.com/post/32583376161/writing-biginteger-better-than-jdk-one // - BigInt numbers may be stored with leading 0s // - BigInt only works with non-negative integers class BigInt { public static final BigInt ZERO = new BigInt("0"); public static final BigInt ONE = new BigInt("1");
}
Hackerrank should enable GMP and BCMath functions on their PHP servers to enable PHP users solve problems involving big integers. These functions are integral part of PHP and they used to work before on their servers but suddenly started giving error messages "function not defined" when trying to use any of the functions. I think they did an upgrade and just forgot to enable the functions again.
My solution passed test cases 0 to 32 but failed on other test cases ("wrong answer", not timeout) Can someone give the input of any of those test cases (e.g test case 50) so that I can debug my code? Thanks in advance
Hey can someone help me out solving these problems? My friend sent this contest to me. He says its for noobs but I dont think it is. I cant solve it without any help because I'm new to competitive programming. Here is the contest: https://www.hackerrank.com/newbie-challenge
java code: