University at Buffalo 2024
Java - Default language
My Stats
EXP gained
4864
Level
5 (Champion)
Community stats
Discussions
0
0
Know more
75
Total problems solved
56
Easy
18
Moderate
1
Hard
0
Ninja

Current streak:

3 days

Longest streak:

4 days

Less

More

Achievements
3
Ronin
Topics
Arrays
Strings
+ 1 more
Discussions
Java Solution using ArrayList
Interview problems
``````public class Solution {
public static Node firstNode(Node head) {
return null;
}

ArrayList<Node> hm = new ArrayList<>();
}
}
return null;
}
}``````
Chirayu Sanghvi
Published On 28-Nov-2023
19 views
0 replies
Easy Java Solution, performed better than 90 % submission here.
Interview problems
``````public class Solution {

public static boolean isAnagram(String str1, String str2) {
if(str1.length() != str2.length()){
return false;
}
char[] ch1 = str1.toCharArray();
char[] ch2 = str2.toCharArray();
Arrays.sort(ch1);
Arrays.sort(ch2);
String s1 = new String(ch1);
String s2 = new String(ch2);
if(s1.equals(s2))
return true;
return false;
}
}``````
Chirayu Sanghvi
Published On 14-Oct-2023
64 views
0 replies
Java Answer, performed better than 99.6 %
Interview problems
``````public class Solution {
public static int[] moveZeros(int n, int []a) {
int[] arr = new int[n];
int count =0;
int j=0;
for(int i=0;i<n;i++){
if(a[i]==0){
count ++;
continue;
}
else{
arr[j]=a[i];
j++;
}
}
for(int i=0;i<count;i++){
arr[i+j]=0;
}
return arr;
}
}``````
Chirayu Sanghvi
Published On 22-Sep-2023
20 views
0 replies