Memory Exceeded Error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Memory Exceeded Error

why do I keep getting the memory exceeded error when I input a number greater than 22 in this code https://code.sololearn.com/cHHleG5dUBoM/?ref=app

26th Aug 2017, 4:18 PM
David Akhihiero
David Akhihiero - avatar
5 Answers
+ 8
hmm will try wit stringbuilders
27th Aug 2017, 12:52 PM
David Akhihiero
David Akhihiero - avatar
+ 8
tried stringbuilders it didnt work
28th Aug 2017, 5:01 PM
David Akhihiero
David Akhihiero - avatar
+ 7
you have a limited memory, time on sololearn if your program goes above that you get the error memory exceeded, time limit exceeded. https://www.sololearn.com/discuss/649687/?ref=app
26th Aug 2017, 4:41 PM
Lord Krishna
Lord Krishna - avatar
+ 7
it's just that similar codes lyk mine run smoothly where mine fail
26th Aug 2017, 6:18 PM
David Akhihiero
David Akhihiero - avatar
+ 3
Try using StringBuilder instead of Strings. The concatenation is likely what's causing the high memory usage. Or try improving the algorithm! 😜 For example, You probably don't need Strings for converting to Oct or Bin
26th Aug 2017, 7:36 PM
Rrestoring faith
Rrestoring faith - avatar