Company: Visa fte
Difficulty: medium
Alien Technology Code Analysis Imagine you\'re part of a team analyzing fictional alien technology logs. You have a string alienCode , which represents activity codes from their devices. Your task is to examine this string and count how many substrings of this code represent numbers evenly divisible by 3. It\'s important to note that none of these substrings should start with zero unless the substring is the character \"0\" itself. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(alienCode.length²) will fit within the execution time limit. Examples Example 1: Input: alienCode = \"456\" Output: solution(alienCode) = 3 Consider all substrings of the given string: alienCode[0..0] = 4 isn\'t divisible by 3 alienCode[1..1] = 5 isn\'t divisible by 3 alienCode[2..2] = 6 is divisible by 3 alienCode[0..1] = 45 is divisible by 3 alienCode[1..2] = 56 isn\'t divisible by 3 alienCode[0..2] = 456 is divisible by 3 There are 3 subst