Try to enjoy your work while doing it,it will Automatically convert in Hard Work...
Array 1: 1#4#5#15#2#17 for elements 1,4,5,15,2,17
All things are lawful, but not all things are profitable.
I am confused from where to start
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
All things are lawful, but not all things are profitable.
Khusbu Sinha wrote:I have to compare two String arrays with integer inputs separated by "#".
Eg:
Array 1: 1#4#5#15#2#17 for elements 1,4,5,15,2,17
Array 2: 5#4#1#17#2#15 for elements 5,4,1,17,2,15
and print "yes" if the two arrays have same integer values irrespective of their position in the array.
Eg: For the above arrays, output is "yes".
I am confused from where to start. Is `compareTo()` and charAt() useful here?
Try to enjoy your work while doing it,it will Automatically convert in Hard Work...
Try to enjoy your work while doing it,it will Automatically convert in Hard Work...
Why do you pass in 'size' while s1 and s2 sizes are same (s1 and s2 creation relies on size value)?Khusbu Sinha wrote:System.out.println(equivalent (size, s1, s2));
Please explain what do you want to achieve here. Look at your comment - looks like you had a 'start of commend in your head...' cut... 'then added some other bit'. Comments most likely going to be read by others, so, such comment is almost useless.Khusbu Sinha wrote:
Try to enjoy your work while doing it,it will Automatically convert in Hard Work...
Khusbu Sinha wrote:I have to compare two String arrays with integer inputs separated by "#".
Eg:
Array 1: 1#4#5#15#2#17 for elements 1,4,5,15,2,17
Array 2: 5#4#1#17#2#15 for elements 5,4,1,17,2,15
and print "yes" if the two arrays have same integer values irrespective of their position in the array.
Eg: For the above arrays, output is "yes".
Khusbu Sinha wrote:(...)
This problem is a mini-part of a bigger assignment. The actual problem is an array of strings. Eg: 1#2#3, 4#5#7, 6#5#9 and there are two such arrays which later needs to be checked for transformation using legal sequence of row and column moves.(...)
There are three kinds of actuaries: those who can count, and those who can't.
All things are lawful, but not all things are profitable.
Khusbu Sinha wrote:It's because I have to use this int[][] later in the program for some calculations. That's why I decided to return an int[][] from this method to perform both the comparison as well as the calculation.
My code for copying the list into int[][] is wrong.
All things are lawful, but not all things are profitable.
Knute Snortum wrote: Parse it directly into an int[][].
Carey Brown wrote:You have too many nested loops. You only need 2.
Khusbu Sinha wrote:Adding the following at Line 10 does not help.
Where do I go wrong here?
Khusbu Sinha wrote:Adding the following at Line 10 does not help.
Where do I go wrong here?