You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// when length of each row is samefor (intcol = 0; col < matrix[0].length; ++col) {
intcolSum = 0;
for (introw = 0; row < matrix.length; ++row) {
colSum += matrix[row][col];
}
System.out.println("col sum: " + colSum);
}
Copy Array
// Any changes made to copied object will not be reflected in original object or vice-versa.String[] temp = Arrays.copyOf(inputArray, inputArray.length);
List to Array
String
List<String> res = newArrayList<String>();
res.toArray(newString[0]);
int
List<Integer> res = newArrayList<Integer>();
res.stream().mapToInt(i->i).toArray();
String to charecter frequency array
int [] s1Freq = newint [26];
for(inti = 0; i < s1.length(); ++i){
s1Freq[s1.charAt(i) - 'a']++;
}
Digit Sum
Stringnumber = "2345";
for (intx = 0; x < number.length(); x++)
sum += Integer.parseInt(number.charAt(x)+"");