Skip to content

Commit b6ce995

Browse files
committed
May 15
1 parent 39ffbe8 commit b6ce995

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def getLongestSubsequence(self, words: list[str], groups: list[int]) -> list[str]:
3+
return [word for i, word in enumerate(words) if i == 0 or groups[i] != groups[i - 1]]
4+
5+
6+
def main():
7+
words = ['e', 'a', 'b']
8+
groups = [0, 0, 1]
9+
assert Solution().getLongestSubsequence(words, groups) == ['e', 'b']
10+
11+
words = ['a', 'b', 'c', 'd']
12+
groups = [1, 0, 1, 1]
13+
assert Solution().getLongestSubsequence(words, groups) == ['a', 'b', 'c']
14+
15+
16+
if __name__ == '__main__':
17+
main()

2025-05-May-LeetCoding-Challenge/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
| May 12 | [2094. Finding 3-Digit Even Numbers](https://leetcode.com/problems/finding-3-digit-even-numbers/) | Easy | Solved |
1919
| May 13 | [3335. Total Characters in String After Transformations I](https://leetcode.com/problems/total-characters-in-string-after-transformations-i/) | Medium | Solved |
2020
| May 14 | [3337. Total Characters in String After Transformations II](https://leetcode.com/problems/total-characters-in-string-after-transformations-ii/) | Hard | Unsolved |
21-
| May 15 | []() | | |
21+
| May 15 | [2900. Longest Unequal Adjacent Groups Subsequence I](https://leetcode.com/problems/longest-unequal-adjacent-groups-subsequence-i/) | Easy | Solved |
2222
| May 16 | []() | | |
2323
| May 17 | []() | | |
2424
| May 18 | []() | | |

0 commit comments

Comments
 (0)