Amazon Interview Question for Quality Assurance Engineers

Country: India
Interview Type: Written Test

Comment hidden because of low score. Click to expand.
of 0 vote

Always remember that whenever a string question is thrown at you, just remember this "A string is noting but an array of character that ranges from 0-256 chars(assuming all the char are alphabets)"

Now to the question,
you can sort the first and sort the second using library function,
and compare each char by char
Time Complexity -> O(n*logn)
## If len(str2) != len(s1) -> return false, strings of uneven lengths can never be anagrams

- Gaurav May 11, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

import java.util.*;
class Anagrams {

  static boolean isAnagram(String a, String b) {
        char c[] = a.toLowerCase().toCharArray();
        char d[] = b.toLowerCase().toCharArray();
            return true;
        return false;

  public static void main(String[] args) {
     Scanner scan = new Scanner(;
    System.out.println("Enter first String: ");
    String a =;
    System.out.println("Enter seconf jumbled String");
    String b =;
    boolean ret = isAnagram(a, b);
    System.out.println( (ret) ? "Anagrams" : "Not Anagrams" );

- Sameer May 11, 2019 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More