Answer: FUJITSU Hiring | Campus Interview Question | On-Campus OA (2023)
Answer · Posted Jun 2026
Approach Instead of comparing every character of two words repeatedly, represent each word using a 26-bit bitmask. Each bit represents one lowercase letter (a to z). If a letter exists in a word, set its corresponding bit. Two words have no common letters if: (mask1 & mask2) == 0 Then calculate the product of their lengths and keep track of the maximum value. Strategy Create a bitmask for every word. Each bit indicates whether a character exists in the word. ...
The full answer & interview discussion are available to premium members.
Log in Create a free account