LeetCode

[Solved] First Letter to Appear Twice LeetCode Contest Problem

[Solved] First Letter to Appear Twice LeetCode Contest Problem

Given a string s consisting of lowercase English letters, return the first letter to appear twice. Note: A letter a appears twice before another letter b if the second occurrence of a is before the second occurrence of b. s will contain at least one letter that appears twice. First Letter to Appear Twice LeetCode Contest…

[Solved] Spiral Matrix IV LeetCode Contest Problem

[Solved] Spiral Matrix IV LeetCode Contest Problem

Spiral Matrix IV: You are given two integers m and n, which represent the dimensions of a matrix. You are also given the head of a linked list of integers. Generate an m x n matrix that contains the integers in the linked list presented in spiral order (clockwise), starting…

[Solved] Decode the Message LeetCode Contest Problem

[Solved] Decode the Message LeetCode Contest Problem

Decode the Message: You are given the strings key and message, which represent a cipher key and a secret message, respectively. The steps to decode message are as follows: Use the first appearance of all 26 lowercase English letters in key as the order of the substitution table. Align the substitution…

[Solved] Maximum Score Of Spliced Array LeetCode Contest Problem

[Solved] Maximum Score Of Spliced Array LeetCode Contest Problem

You are given two 0-indexed integer arrays nums1 and nums2, both of length n. You can choose two integers left and right where 0 <= left <= right < n and swap the subarray nums1[left…right] with the subarray nums2[left…right]. For example, if nums1 = [1,2,3,4,5] and nums2 = [11,12,13,14,15] and you choose left = 1 and right = 2, nums1 becomes [1,12,13,4,5] and nums2 becomes [11,2,3,14,15]. You may choose to apply…