OA VO support

Amazon Recent Online Assessment (OA) Coding Question Reveal – 亚马逊近期笔试题(OA)真题揭露 – OA 代写 – 一亩三分地 – VO support

Thank you for your interest in Software Development Engineering opportunities at Amazon

Amazon近期发放的OA越来越难了,今天更新的又是一道超难的题目,我们一起看看吧。

Code Question 2

A team of data analysts at Amazon is working to identify patterns in data. During their analysis, they found a category of string they call dominant string:

  • It has an even length.
  • And the string contains at least one character having frequency matching the exactly half of the length of the string.

Given a string s of length n, determine the number of its distinct substrings that are dominant strings.

Example

s = "idafddfi"

All even-length substrings of s with a frequency of any character that is exactly half their length are:

SubstringLength of SubstringFrequent CharacterFrequency of Character
id2d/i1
da2d/a1
af2a/f1
fd2f/d1
df2d/f1
fi2f/i1
dafd4d2
afdd4d2
fddf4f/d2
dfii4i2
idafdd6d3
dafddf6d3

There are 13 dominant substrings in s.


Function Description

Complete the function getDominantStringCount in the editor below.

getDominantStringCount has the following parameter:

  • string s: the string to analyze

Returns

  • int: the number of dominant substrings in s

Constraints

  • 1 ≤ n ≤ 10^5
  • s consists of lowercase English letters in the range 'a' to 'j' (inclusive) only.

Sample Case 0

Input:

s = "aaaaiid"

Output:

3

Explanation:

The dominant substrings are:

  • ai
  • id
  • aaid

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *