GRUNDFOS Hiring Challenge | Count Asterisks | Off-Campus OA (2025)

Question · Posted Jun 2026

Q1: Count Asterisks Problem Statement Given a string s containing lowercase letters, *, and | characters, count the number of * characters that are not between a pair of | characters. Example Input s = "l|*e*et|c**o|*de|" Output 2 Constraints 1 <= s.length <= 1000 Test Cases Test Case 1 Input: s = "l|*e*et|c**o|*de|" Output: 2 Test Case 2 Input: s = "*****" Output: 5 Test Case 3 Input: s = "|**|***" Output: 3

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

Log in Create a free account