Funky chess board problem

my code is ok i just want to know that in my code i have initialized a variable hi and after passing in the function set and then again calling it in the main function value of hi is not changing. could u plzz tell me how i can pass this as a reference.
code link : https://ide.codingblocks.com/s/95177

In java you can’t pass a variable as call by reference . But if you want the changes made by your function to persist , you can use static variable.

After declaring my variable as static it is still showing the same output can someone plzz correct my code.
code link : https://ide.codingblocks.com/s/95177

You are not returning anything from set function and the value of hi always 0 , So your answer is always coming sum.
Moreover you have to count the min number of unreachable squares . Correct your logic accordingly

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.