Question: Write a function using pseudocode in C++ that would return a peaky string in an array of strings. The function takes in as input an

Write a function using pseudocode in C++ that would return a "peaky string" in an array of strings. The function takes in as input an array of strings and returns a "peaky string". A "peaky string" is defined as a string whose length is greater than the length of both the strings which are adjacent to this string. For strings that are at the boundaries of an array, a "peaky string" must have length greater than one adjacent string. Also, state and explain the worst case time complexity of your solution in terms of Big O using appropriate variables, justifying your rationale .

Example 1:

apple banana pineapple coconut cocoa pear In this array,

"pineapple" is the only "peaky string".

Example 2:

apple banana pineapple coconut cocoa dragonfruit

In this array, "pineapple" and "dragonfruit" are "peaky strings.

You can return any of them but not both.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!