Analysis of Algorithms Problem 3 Academic Essay

You are given two s: N and K. Lun the dog is interested in strings that satisfy
the following conditions:

• The string has exactly N characters, each of which is either ‘A’, ‘B’ or ‘C’.
• The string s has exactly K pairs (i, j) (0 <= i < j <= N-1) such that s[i] < s[j].

If there exists a string that satisfies the conditions, find and return any such string.
Otherwise, return an empty string.

Definition

Class: ABC
Method: createString
Parameters: int, int
Returns: String Method
signature: String createString(int N, int K)
(be sure your method is public)

Limits

Time limit (s): 2.000
Memory limit (MB): 256

Constraints

– N will be between 3 and 30, inclusive.
– K will be between 0 and N(N-1)/2, inclusive.

 

Looking for the best essay writer? Click below to have a customized paper written as per your requirements.

 

find the cost of your paper

Is this question part of your assignment?

Place order