LeetCode 2839: Check if Strings Can Be Made Equal

Solved LeetCode 2839 – Check if Strings Can be Made Equal With Operations I today. In simple terms, we are given two strings and allowed to swap characters only at positions that are 2 indices apart (like index 0 with 2, 1 with 3). So instead of trying all swaps, the idea is to separate characters at even and odd positions and check if both strings have the same characters in those positions. If the frequency of characters matches for even and odd indices separately, then the strings can be made equal. A simple yet interesting problem that improves thinking around patterns and constraints. #LeetCode #DSA #Java #ProblemSolving #CodingJourney

  • text

To view or add a comment, sign in

Explore content categories