Store all prefixes of numbers from arr1 in a HashSet.
Example for 12345:
We get these prefixes by repeatedly dividing by 10.
Then for every number in arr2, keep removing digits from the end and check if that prefix exists in the set.
Example:
Store all prefixes of numbers from arr1 in a HashSet. Example for 12345: 12345 1234 123 12 1 We...
Store all prefixes of numbers from arr1 in a HashSet.
Example for 12345:
We get these prefixes by repeatedly dividing by 10.
Then for every number in arr2, keep removing digits from the end and check if that prefix exists in the set.
Example:

Hello everyone! 👋 Let's solve the longest common prefix Before solving the problem. we should...

Longest Common Prefix Write a function to find the longest common prefix string amongst...

class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: Longest_sum =...

🔗 Problem Link: https://leetcode.com/problems/longest-consecutive-sequence/ The Longest Consecutive...

Question : Implement next permutation, which rearranges numbers into the lexicographically...

Documenting my daily LeetCode journey here! Today's Problem: 1512. Number of...