[Huawei OD test questions] Jumping grid 2 HUAWEI (C&C++&java&python&JavaScript&go) 100% pass rate

[Huawei OD machine test real questions 2022&2023] real test catalog @click here @
[Huawei OD machine test real questions] signal transmission and reception & trial reading & @click here @
[Huawei OD machine real test questions] rent a car to ride the greenway & trial reading & @点here@

jump grid 2

topic description

Xiao Ming and his friends are playing the grid jumping game. There is a circle composed of n consecutive grids, and each grid has a different score. The child can choose to jump from any grid, but he cannot jump consecutive grids, jump back, and cannot exceed one circle;
Given an array of non-negative integers representing the scores for each cell, compute the highest possible score.

enter description

Given a number example, the first grid and the last grid are connected end to end, such as: 2 3 2

output description

Output the highest score that can be obtained, such as:

Guess you like

Origin blog.csdn.net/weixin_45541762/article/details/132010728