Amazon - How Many X’s In a RangeGiven two integers L, R, and digit X. Find the number of occurrences of X in all the numbers in the range (L, R) excluding L and R. Example 1: Input: L=10, R=19, X=1 Output: 9 Explanation: There are 9 1s (11, 12, 13, 14, 15, 16, 17, 18) in the number...Dec 7, 2023·2 min read
2000. Reverse Prefix of WordProblem Link: https://leetcode.com/problems/reverse-prefix-of-word/description/ Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If t...Nov 26, 2023·4 min read
1662. Check If Two String Arrays are EquivalentGiven two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise. A string is represented by an array if the array elements concatenated in order forms the string. Example 1: Input: word1 = ["ab", ...Nov 23, 2023·2 min read
1859. Sorting the SentenceA sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters. A sentence can be shuffled by appending the 1-indexed word position to each word and...Nov 22, 2023·3 min read
1528. Shuffle StringYou are given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the i<sup>th</sup> position moves to indices[i] in the shuffled string. Return the shuffled string. Example 1: Example...Nov 21, 2023·3 min read
Check if the String is PangramA pangram is a sentence containing every letter in the English Alphabet. String s = "abcdefghijklmnopqrstuvwxyz" The above string contains all the alphabet so it is a pangram. public class Panagram { public static void main(String[] args) { Str...Nov 19, 2023·1 min read
Fibonacci SeriesThe Fibonacci series is a series where the next term is the sum of the previous two terms. The first two terms of the Fibonacci sequence are 0 followed by 1. Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 public class Fibonacci { public static v...Nov 18, 2023·2 min read