BROWSERSTACK Hiring On-Campus OA (2021) | Problem Bulls and Cows

Question · Posted Jun 2026

Problem Statement You are playing the classic Bulls and Cows game. You are given two strings: secret → the secret number. guess → your friend's guess. Both strings contain only digits and have the same length. Definitions A Bull is a digit that matches in both value and position. A Cow is a digit that exists in both strings but is located at different positions. Return the result in the format: xAyB Where: x = number of Bulls y = ...

The full answer & interview discussion are available to premium members.

Log in Create a free account