Skip to content
This repository was archived by the owner on Mar 14, 2022. It is now read-only.

[Homework 3] 尋找小幫手 #32

@alice31229

Description

@alice31229

提交連結

https://judge.ccclub.io/status/caee438eed781962d8db605dee845802

程式碼

def find_helper(children):
    # do something
    ans=-1
    l=[]
    l.append(children.pop())
    i=len(children)-1
    while len(children)>=3:
        temp=children.pop()
        
        if temp>l[-1] and temp>children[-1]:
            ans=i
            return ans
        
        l.append(temp)
        i-=1
    
    return ans

錯誤訊息

Wrong answer

問題描述

請問在已知全園最矮小朋友在隊伍兩端還有所有小朋友身高不重複的情況下,有沒有出現回傳值是-1的可能?還是我的除錯方向想錯了?
我的程式有盡量用python list operation O(1)的方式去寫,不曉得有沒有沒考慮到的狀況導致wrong answer,想了很久還是沒有方向,需要指點,謝謝!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions