Lexicographically Bigger String
Given lowercase alphabet strings s and t of the same length, return whether there’s some anagram of s, say a, and some anagram of t, say b, such that:
a[i] ≤ b[i]for all0 ≤ i < norb[i] ≤ a[i]for all0 ≤ i < n.
Constraints
1 ≤ n = m ≤ 100,000wherenandmare the lengths ofsandt.
https://binarysearch.com/problems/Lexicographically-Bigger-String
Examples
Example 1
Input
- s =
adc - t =
bec
Output
- answer =
True
Explanation
We can have a = "acd" and b = "bce" and we have:
"a" ≤ "b""c" ≤ "c""d" ≤ "e"
Leave a comment