All mistakes have been corrected. Thanks a lot for all the feedbacks from the Solutions! You guys are awesome! 🫡
Amazon developers are building a prototype for a regex generator for the given strings
For the prototype version, the regex consists of uppercase English letters, '[' and ']'.
For the prototype version, the regular expression is composed of uppercase English letters along with the characters '[' and ']'. In this case, any string of characters that is enclosed within the square brackets '[' and ']' will match any one of the characters in that string. It's important to note that the string inside the square brackets consists solely of uppercase English letters, and there is no repetition of characters within the brackets.
Here, a string of characters enclosed in square brackets '[' and ']' matches any of the one characters in that string.
Also, the string of characters enclosed within '[' and ']' consists of uppercase English letters only with no repetition.
For example:
The errors in the above example were corrected on 06-19-2025, thanks to the helpful source shared by an awesome friend! Here is the relevant ss for your reference -
Some very important notes for you to solve this question -- please read --
Let's complete the func in the editor on the right side of the screen ---->>>
What parameters doesfindTheLongestPossibleRegularExpression get and what does it return?
x: a string :)y: a string :Oz: a string :3
Your task this time is to find the longest expression (a.k.a.regex) that is lexicographically smallest and matches both x and y but not z. If no such expression (regex) exists, return "-1".
💐ᝰ.ᐟ animi༊·° and freya༊·° slay 🌷 👏
x = "AB" y = "BD" z = "CD" return = "[ABCDEFGHJKLMNOPQRSTUVWXYZ][ABCDEFGHJKLMNOPQRSTUVWXYZ]"
x = "AERB" y = "ATRC" z = "AGCB" return = "[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ]"
x = "ABCD" y = "CODE" z = "CODE" return = "-1"
- Closest Version DateONSITE INTERVIEW · Seen Jul 2026
- Maximum Concurrent Processes (Bar Raiser Round)ONSITE INTERVIEW · Seen Jul 2026
- Maximum Product New RatingOA · Seen Jul 2026
- Permutation SorterOA · Seen Jul 2026
- Get Distinct Pairs (Also apply to AS intern)Seen Jul 2026
- Maximum Final ValueSeen Jul 2026
- Minimum Delivery Center InconvenienceOA · Seen Jun 2026
- Unfulfilled Customers by Inventory PriorityOA · Seen Jun 2026
public String findTheLongestPossibleRegularExpression(String x, String y, String z) {
// write your code here
}