Smallest String After One Fixed-Length Reversal
Updated
Problem statement
Given word and k, return the lexicographically smallest string obtainable by reversing at most one contiguous substring of exactly k characters. You may leave the string unchanged.
Function
findSmallestString(word: String, k: int) → StringExamples
Example 1
word = "aabdc"k = 2return = "aabcd"Reverse the final dc to get aabcd.
Example 2
word = "aacbd"k = 2return = "aabcd"Reverse cb to get aabcd.
Constraints
- 1 <= word.length <= 500.
- 1 <= k <= word.length.
- For this exercise, assume word contains only lowercase English letters.
Source note: Original OA task images and any included source example. The practice contract follows the rules stated in the problem and source note.
More Adobe Online Assessment questions
- Base Unit ConversionsOA · Seen Nov 2026
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Top-Funded Villages and ProjectsOA · Seen Aug 2026
- Count Parent Nodes With a Target SumOA · Seen Aug 2026
- Largest Binary Number by ConcatenationOA · Seen Aug 2026
- Count Events by CategoryOA · Seen Aug 2026
- Graph M-ColoringOA · Seen Aug 2026
- Hall of Shifting TilesOA · Seen Aug 2026
- K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
- Maze ReachabilityOA · Seen Aug 2026
Similar questions at other companies
- Longest Palindromic SubsequenceAXQ Capital · OA
- Classify Password StrengthHackerRank · OA · PHONE SCREEN · ONSITE INTERVIEWHackerRank interview questions
- Polynomial CoefficientsShopify · OAShopify interview questions
- Merge Ordered Message FragmentsVeeam · OA
- Basic Calculator IITypeSafe AI · OA
- Count One-Swap Number PairsCapital One · OACapital One interview questions
- Find a String Within One Mismatch of AllBarclays · OABarclays interview questions
- Maximum String OperationsMicrosoft · OAMicrosoft interview questions
- Reliable LLM Call with Independent Retry BudgetsStripe · OAStripe interview questions
- Maximum Equal-Bit Pairs in a SubsequenceAmazon · OA
Adobe interview experiences
- Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
- Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
- Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
- Adobe New Grad MTS Interview Questions: 7 Experiences
- Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)