Tap here to switch tabs
Problem
Submissions

Problem: Check If a String Can Break Another String

Check If a String Can Break Another String compares equal-length strings and asks whether either string can be rearranged to be alphabetically at least a rearrangement of the other at every position.

Statement

Given two strings s1 and s2 of the same length, return true if some permutation of s1 can break some permutation of s2, or if some permutation of s2 can break some permutation of s1. Otherwise, return false.

A string x can break a string y (both of length n) if x[i] >= y[i] in alphabetical order for every index i where 0≤i<n0 \leq i < n.

Constraints:

  • s1.length ==n== n

  • s2.length ==n== n

  • 1≤n≤1051 \leq n \leq 10^5

  • s1 and s2 consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If a String Can Break Another String

Check If a String Can Break Another String compares equal-length strings and asks whether either string can be rearranged to be alphabetically at least a rearrangement of the other at every position.

Statement

Given two strings s1 and s2 of the same length, return true if some permutation of s1 can break some permutation of s2, or if some permutation of s2 can break some permutation of s1. Otherwise, return false.

A string x can break a string y (both of length n) if x[i] >= y[i] in alphabetical order for every index i where 0≤i<n0 \leq i < n.

Constraints:

  • s1.length ==n== n

  • s2.length ==n== n

  • 1≤n≤1051 \leq n \leq 10^5

  • s1 and s2 consist only of lowercase English letters.