Visa Online Assessment(code signal round) questions and experience
Summary
I recently completed my CodeSignal online assessment for Visa, which consisted of four coding challenges. I prioritized solving the easier problems first, then tackled the medium one, and finally dedicated time to the hard question.
Full Experience
I just completed my CodeSignal round for Visa. It had 4 questions: two easy, one medium, and one hard. My strategy was to quickly solve the easy ones first, then move to the medium, and finally spend as much time as possible on the hard one. I successfully completed the first two easy questions (Q1 and Q2), then proceeded to the medium one (Q4), and concluded with the hard question (Q3).
Interview Questions (4)
Given a string, count the number of triplet substrings where the first and last characters are the same. A triplet substring implies a contiguous substring of length 3.
Input -> Outputtext = "" -> 0text = "abc" -> 1text = "abcxccc" -> 2
Given an array of integers, keep adding each digit of the numbers until its one digit (digital root). Return the max of each of these results.
Example:[123, 456, 789, 101]
# first round -> 1+2+3, 4+5+6, 7+8+9, 1+0+1 -> 6, 15, 24, 2
# second round -> 6, 1+5, 2+4, 2 -> 6, 6, 6, 2
# max = 6 -> output = 6
There are N centers, each with a fixed processing capacity.
A log of events arrives:
"PACKAGE"→ send 1 package to the next open center (cyclic order).- A center can handle only
capacity[i]packages before needing a reset. "CLOSURE j"→ centerjbecomes permanently closed.
After attempting a full rotation (i.e., checking all centers without finding one with remaining capacity), → reset all open centers to full capacity.
Return the index of the center that processed the most packages.
If tied → return the highest index.
Example:
centerCapacities = [1,2,1,2,1]dailyLog = [ "PACKAGE", "PACKAGE", "CLOSURE 2", "PACKAGE", "CLOSURE 3", "PACKAGE", "PACKAGE" ]Output:
1A sawtooth subarray is a contiguous sequence where parity strictly alternates between even and odd.
Count how many such subarrays exist (length ≥ 1).
Input: [1,3,5,7,9]
Output: 5
# Only single-element subarrays qualify (all odd → no alternation)
Input: [1,2,1,2,1]
Output: 15
# Entire array alternates → all subarrays are valid (n*(n+1)/2)
Input: [1,2,3,7,6,5]
Output: 12
# Alternation breaks at (3,7)