Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Lining Wang
More space-saving solution

Lining Wang

Nov 1, 2023

The right suffix array doesn't need to be calculated since you can calculate the total of all elements once, subtract the left suffix, and the current element to get the right suffix value.

2

0

Comments
Comments
cyril gorrieri
cyril gorrieri2 years ago

That's also how I solved the problem

On this page

Problem Statement

Examples

Solution

Step-by-step Algorithm

Algorithm Walkthrough

Code

Complexity Analysis

Time Complexity

Space Complexity