Description
Solutions
Submission
Return Records π₯
π€ INTERN
As an intern at Amazon, you have been assigned a task to implement the sign-in pages in the Amazon Dummy Website.
There are three sign-in pages, each with its own API:
Given a log of API requests, return the list of returns from the mock website.
Notes:
Function Description
Complete the function returnRecords
in the editor below.
returnRecords
has the following parameter:
string attempts[n]
: each of the API requestsReturns
string[n]
: an array of strings where #th string is the return value of the #th API requestqοΎπ κ°α Credit to neoέ ΰ»κ± π qοΎ
Example 1:
Input: attempts = ["register user05 qwerty", "login user05 qwerty", "logout user05"]
Output: ["Registered Successfully", "Logged In Successfully", "Logged Out Successfully"]
Explanation:Check out the example image above π
Example 2:
Input: attempts = ["register david david123", "register adam 1Adam1", "login david david123", "login adam 1adam1", "logout david"]
Output: ["Registered Successfully", "Registered Successfully", "Logged In Successfully", "Login Unsuccessfully", "Logged Out Successfully"]
Explanation:register david david123: There is not user with the username "david" registered, so the registration is successful register adam 1Adam1: There is not user with the username "adam" registered, so the registration is successful login david david123: The username and the password for the user match with that in the database, so the login is successful login adam 1adam1: The password("1adam1") does not match the actual password ("1Adam1"), so the login is unsuccessful logout david: The user "David" is logged in currently, so the logout is successful
Constraints:
- 1 β€ n β€ 105
- 1 β€ |username|, |password| β€ 10 (where |s| is the length of string s)
- username and password are alphanumeric strings, ranges [0-9, a-z, A-Z]
Related Problems
Testcase
Result
Case 1
input:
output: