0% found this document useful (0 votes)
23 views7 pages

Hacker Rank

The document discusses a Hacker rank challenge with 2 coding problems and 10 multiple choice questions to be completed in 70 minutes, including finding the first unique character in a string and determining if two strings are anagrams.

Uploaded by

Anupam Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views7 pages

Hacker Rank

The document discusses a Hacker rank challenge with 2 coding problems and 10 multiple choice questions to be completed in 70 minutes, including finding the first unique character in a string and determining if two strings are anagrams.

Uploaded by

Anupam Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Hacker rank

2 coding, 10 mcq

70min

1. First unique character

public int firstUniqChar(String s) {


int count=-1;
if(s == null || s.length() < 1) {
return -1;
}
else if (s.length() == 1) {
return 0;
}

for(Character ch:s.toCharArray()){
if(s.indexOf(ch)==s.lastIndexOf(ch)){
count=s.indexOf(ch);
break;
}

}
//If no unique character is found, count will still be -1
return count;
}
2. Anagram

You might also like