+ 4

Hey, guys i don't know how to implement this problem in java can u plz tell me how i can do this.. click the YouTube link

https://youtu.be/f7rRi0EUHiM

20th Jun 2018, 6:30 AM
Code_Magician❤
Code_Magician❤ - avatar
4 Respostas
+ 4
here what I have done is I choose 1st column by passing 0 form the main function then I maintain list which will keep track of row and col on which I have already selected the Number then I call the isSafe function to check if I have placed any thing on the same row before and if I haven't selected any number from that row then it selects that number and add to the selected list and then it goes for selecting next col so since I am always selecting the col next to the last one by col + 1 I don't have to worry about coloumn so I only checked rows in is safe function. so this is how I selected different rows every time. and when 4 elements selected I just print the selected number. I can comment my code out if you want.
22nd Jun 2018, 9:42 AM
Tanay
Tanay - avatar
+ 3
Hi Arjun, here I have have wrote code which finds all possible solution that sums up to 34. https://code.sololearn.com/c1J116eS3bj4/?ref=app
21st Jun 2018, 7:02 PM
Tanay
Tanay - avatar
+ 2
Tanay thank you so much😘
22nd Jun 2018, 3:27 AM
Code_Magician❤
Code_Magician❤ - avatar
+ 1
Tanay if we select number 1 and we don't have to choose the same row and col how can I do that?!?
22nd Jun 2018, 3:29 AM
Code_Magician❤
Code_Magician❤ - avatar