Parenthetical brainteaser

  • 6
  • Locked
It turns out that we have some code that doesn't do what we need it to. It also turns out that you have to fix this now. To get the correct result, you need to play around with parentheses: arrange them so that the desired number (382) appears on the screen.
You can't complete this task, because you're not signed in.
Comments (52)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
sachin
Level 8 , Singapore, Singapore
15 June 2021, 16:32
took a while to identify the logic. Thanks for the hints given below.
Luke
Level 5 , Brisbane, Australia
5 April 2021, 08:57
I was looking for 2 opening and 2 closing parentheses. Never would have got it because the answer is different. Maybe I interpreted it wrong.
Sanika
Level 5 , Pune, India
3 January 2021, 05:39
Completed in first attempt! Took me about 5 mins to figure out the solution. Putting parenthesis was quite easy. More of a math puzzle than coding problem!
Java_Mooood
Level 3 , San Antonio, United States
16 October 2020, 16:44
Hint = 2 * 191
Alhoussein Camara
Level 7 , United States of America
3 August 2021, 03:59
thanks for the hint
remote87
Level 18 , Sofia, Bulgaria
6 October 2020, 16:18
it took me 2 days of trying with no thinking, 2 days of not thinking at all about the problem and ... 10 minutes of thinking hard about the problem and couple of tests...It's really that important when you feel stuck to stop thinking about the problem for a while and when you come back with a fresh mind you can achieve everything!!! Pro Java Dev I will take you down!!!
Hammad
Level 4 , Limerick, Ireland
3 August 2020, 15:16
It took me 65 attempts to solve. Hint: 3 parenthesis to be used in total including printing method's. Hint: Num 2 in the beginning will multiply with rest of the numbers. Best of luck!
peter
Level 13 , Den Haag, Netherlands
27 July 2020, 13:20
it took me hours more than needed because i thouhgt that there should be 2 opening parenthesis at the beginning and 2 at the end however they mean that you should have 4 parenthesis in total without counting the parenthesis van the println(). good luck with solving it and make sure that you interpreted it the right way otherwise it wil take hours.
Art Skv
Level 4 , Dallas, United States
20 July 2020, 16:18
Math problem, not a coding problem. Brute-forced the solution after 20 tries.
Maryem Vickers
Level 7 , HT..., United Kingdom
24 June 2020, 17:01
It was (shockingly) not hard, but quite easy, accually! 3 attempts! XD
Martzehh
Level 9 , Ottawa, Canada
30 May 2020, 19:47
Solved after 41 attempts and I can confidently say this did nothing to make me a better coder. Just a classic example of the stereotypical whiteboard interview question that isn't the least bit relevant to the task you'll actually be doing.