Amazon Coding Question – Solved

6 Live
Given a string, how many different substrings exist in it that have no repeating characters? Two substrings are considered different if they have a different start or end index. Example s = "abac" The substrings that have no repeating characters in them are "a", "b", "a", "c", "ab", "ba", "ac", and "bac". Note that "aba" and "abac" do not qualify because the character 'a' is repeated in them. Also, note that two substrings, "a" and "a", both qualify because their start indices are different: s[0] and s[2]. There are 8 substrings that have no repeating characters. Function Description Complete the function findSubstrings in the editor below. findSubstrings has the following parameter: string s: the given string Returns int: the number of substrings in s that have no repeating characters Constraints 1 ≀ length of s ≀ 10⁡ s consists of only lowercase English letters, ascii['a'-'z']. Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing bcada

Asked in: Amazon

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |