Answer: REFYNE Hiring | Off-Campus Interview Question | OA (2025)
Answer · Posted Jun 2026
Approach Create a frequency array of size 26. Increment frequency for every character in s. Decrement frequency for every character in t. Positive values indicate characters missing in t. Sum all positive frequencies to get the minimum number of operations. Java Code class Solution { public int minSteps(String s, String t) { int[] freq = new int[26]; for (char c : s.toCharArray()) freq[c - 'a']++; for (char c : t.toCharArray()) freq[c - 'a']--; int steps = 0; for (int f ...
The full answer & interview discussion are available to premium members.
Log in Create a free account