Solved! Leetcode 1641. Count Sorted Vowel Strings

source: https://leetcode.com/problems/count-sorted-vowel-strings/description/ Count Sorted Vowel Strings Given an integer n, return the number of strings of length n that consist only of vowels (a, e, i, o, u) and are lexicographically sorted. A string s is lexicographically sorted if for all valid i, s[i] is the same as or comes before s[i+1] in the alphabet. ...

Solved! Leetcode 369. Plus One Linked List

source: https://leetcode.com/problems/plus-one-linked-list/description/ Plus One Linked List Given a non-negative integer represented as a linked list of digits, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list. Example 1: Input: head = [1,2,3] Output: [1,2,4] Example 2: Input: head = [0] Output: [1] ...

Solved! Leetcode 2187. Minimum Time to Complete Trips

Table of ContentsProblem StatementJavaPython Problem Statement source: https://leetcode.com/problems/minimum-time-to-complete-trips/description/ You are given an array time where time[i] denotes the time taken by the ith bus to complete one trip. Each bus can make multiple trips successively; that is, the next trip can start immediately after completing the current trip. Also, each bus operates independently; that is, ...

Solved! Leetcode 438: Find All Anagrams in a String

source: https://leetcode.com/problems/find-all-anagrams-in-a-string/description/ An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Given two strings s and p, return an array of all the start indices of p’s anagrams in s. You may return the answer in any order. ...

Solved! Leetcode 2361: Minimum Costs Using the Train Line

source: https://leetcode.com/problems/minimum-costs-using-the-train-line/ A train line going through a city has two routes, the regular route and the express route. Both routes go through the same n + 1 stops labeled from 0 to n. Initially, you start on the regular route at stop 0. You are given two 1-indexed integer arrays regular and express, both ...

Solved! Leetcode 953: Verifying an Alien Dictionary

Source: https://leetcode.com/problems/verifying-an-alien-dictionary/description/ In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words ...

Solved! Leetcode 1109: Corporate Flight Bookings

source: https://leetcode.com/problems/corporate-flight-bookings/description/ There are n flights that are labeled from 1 to n. You are given an array of flight bookings bookings, where bookings[i] = [firsti, lasti, seatsi] represents a booking for flights firsti through lasti (inclusive) with seatsi seats reserved for each flight in the range. Return an array answer of length n, where ...

Solved! Leetcode 734: Sentence Similarity

Sentence Similarity We can represent a sentence as an array of words, for example, the sentence "I am happy with leetcode" can be represented as arr = ["I","am",happy","with","leetcode"]. Given two sentences sentence1 and sentence2 each represented as a string array and given an array of string pairs similarPairs where similarPairs[i] = [xi, yi] indicates that ...

Solved! Leetcode 2359: Find Closest Node to Given Two Nodes

You are given a directed graph of n nodes numbered from 0 to n – 1, where each node has at most one outgoing edge. The graph is represented with a given 0-indexed array edges of size n, indicating that there is a directed edge from node i to node edges[i]. If there is no ...

Solved! Leetcode 1626: Best Team With No Conflicts

Table of ContentsBest Team: Problem StatementJavaPython Best Team: Problem Statement You are the manager of a basketball team and your task is to form a best team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the team is the sum of scores of all the ...