Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 2178 | Good Bye 2025 | FINISHED | False | 10800 | 9559523 | Dec. 27, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 25498 ) | A | Yes or Yes | PROGRAMMING | brute force greedy strings |
Last Christmas, your friend Fernando gifted you a string (s) consisting only of the characters (\mathtt{Y}) and (\mathtt{N}), representing "Yes" and "No", respectively. You can repeatedly apply the following operation on (s): Choose any two adjacent characters and replace them with their logical OR . Formally, in each operation, you can choose an index (i) ((1 \leq i \leq |s|-1)), remove the characters (s_i) and (s_{i+1}), then insert: A single (\mathtt{Y}) if at least one of (s_i) or (s_{i+1}) is (\mathtt{Y}); A single (\mathtt{N}) if both (s_i) and (s_{i+1}) are (\mathtt{N}). Note that after each operation, the length of (s) decreases by (1). Unfortunately, Fernando does not want you to combine "Yes OR Yes", as he has experienced trauma relating to a certain song. Determine whether it is possible to reduce (s) to a single character by repeatedly applying the operation above, without ever combining two (\mathtt{Y})'s. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The only line of each test case contains the string (s) ((2\le |s|\le 100)). It is guaranteed that (s_i = \mathtt{Y}) or (\mathtt{N}). For each test case, print " YES " if the string can be reduced to a single character by repeatedly applying the described operation, and " NO " otherwise. You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as positive responses. In the first test case, you cannot combine (s_1) and (s_2) since they are both (\mathtt{Y}). Thus, the answer is NO . In the third test case, the following is a valid sequence of operations: (\mathtt{\underline{NN}Y}\to\mathtt{\underline{NY}}\to\mathtt{Y}). Thus, the answer is YES . In the fourth test case, there are two possi |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 355439795 | ya_hossein | A | Dec. 28, 2025, 4:38 a.m. | OK | C# 13 | TESTS | 4 | 62 | 0 | ||
| 355444119 | rajm89 | A | Dec. 28, 2025, 5:41 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355443519 | Porsche_2030 | A | Dec. 28, 2025, 5:34 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355442727 | nemesis_xo | A | Dec. 28, 2025, 5:23 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355442661 | captainkhan | A | Dec. 28, 2025, 5:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355442325 | govpoli | A | Dec. 28, 2025, 5:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355441632 | Eagle_11 | A | Dec. 28, 2025, 5:07 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355441384 | ah14 | A | Dec. 28, 2025, 5:04 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355439988 | hackerrank.akash | A | Dec. 28, 2025, 4:41 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355439377 | tinhoctinhoc | A | Dec. 28, 2025, 4:31 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355438851 | Om-kathiriya | A | Dec. 28, 2025, 4:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 15 | 0 | ||
| 355446449 | wangruiting | A | Dec. 28, 2025, 6:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355446434 | Ishan_Lodh01 | A | Dec. 28, 2025, 6:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355445619 | Madhur_20 | A | Dec. 28, 2025, 5:58 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355444052 | Arb_103 | A | Dec. 28, 2025, 5:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355440699 | rehanmehta | A | Dec. 28, 2025, 4:53 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355440499 | jay_jani_0011 | A | Dec. 28, 2025, 4:50 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355439407 | aritro_pal | A | Dec. 28, 2025, 4:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355439316 | U.A.K | A | Dec. 28, 2025, 4:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355439160 | 008-IsmailA-2029 | A | Dec. 28, 2025, 4:27 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 | ||
| 355438700 | usedchang | A | Dec. 28, 2025, 4:19 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 15 | 0 |
Back to search problems