FastPrepFind Number of Possible Unique Strings 🍏
Problems/Find Number of Possible Unique Strings 🍏

Find Number of Possible Unique Strings 🍏

Amazon logoAmazon● HardOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Given a string of lowercase characters, pick substring of any length in it and reverse them. Find the number of possible unique strings.

Function

findNumberOfPossibleUniqueStrings(s: String) β†’ int

Complete the function findNumberOfPossibleUniqueStrings in the editor.

findNumberOfPossibleUniqueStrings has the following parameter:

  • String s: the input string

Returns int: the number of possible unique strings

Examples

Example 1

s = "abc"return = 4

Possible unique strings: Substring of length 1: Reversing a single character results in same original string. For example reverse a in abc, gives abc Substring of length 2: Reverse ab (substring of length 2) in abc results in bac Reverse bc (substring of length 2) in abc results in acb Substring of length 3: Reverse abc (substring of length 3) in abc results in cba So return result as 4

Constraints

  • The length of the input string is 1 to 105

More Amazon interview questions

  • LRU Cache for Query ResultsPHONE SCREEN Β· ONSITE INTERVIEW Β· Seen Nov 2026
  • Maximal SquareONSITE INTERVIEW Β· Seen Nov 2026
  • Serialize and Deserialize a Binary TreeONSITE INTERVIEW Β· Seen Nov 2026
  • Course SchedulePHONE SCREEN Β· ONSITE INTERVIEW Β· Seen Nov 2026
  • Course Schedule IIPHONE SCREEN Β· ONSITE INTERVIEW Β· Seen Nov 2026
  • Diagonal Traversal of a Binary TreeONSITE INTERVIEW Β· Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN Β· ONSITE INTERVIEW Β· Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN Β· Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN Β· Seen Nov 2026
  • Maximize K-Element AND with an Increment BudgetOA Β· Seen Nov 2026

Similar questions at other companies

  • Balance a Chemical EquationMicrosoft Β· OAMicrosoft interview questions
  • Binary CircuitAkuna Capital Β· OAAkuna Capital interview questions
  • Minimum Numeric Code TransformationAdobe Β· OAAdobe interview questions
  • Good SubsequencesNutanix Β· OANutanix interview questions
  • Break a PalindromeRoblox Β· OARoblox interview questions
  • Minimize Expression with ParenthesesPinterest Β· OAPinterest interview questions
  • Guess the WordGoogle Β· OA Β· PHONE SCREENGoogle interview questions
  • String Transformation (Also for Infra Automation Intern)Snowflake Β· OASnowflake interview questions
  • Sum of All ValuesFlexport Β· OAFlexport interview questions
  • Smallest Value for a Linear Expression ModuloIntel Β· OA

Interview reports that mention this question

  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
See Amazon hiring insights
Saved
class Solution {
    public int findNumberOfPossibleUniqueStrings(String s) {
      // write your code here
    }

}
Checking account…