Re: [閒聊] 每日leetcode

看板Marginalman作者 (smart0eddie)時間1年前 (2024/08/02 11:44), 編輯推噓0(002)
留言2則, 2人參與, 1年前最新討論串617/1554 (看更多)
2024-08-02 2134. Minimum Swaps to Group All 1's Together II A swap is defined as taking two distinct positions in an array and swapping the values in them. A circular array is defined as an array where we consider the first element and the last element to be adjacent. Given a binary circular array nums, return the minimum number of swaps required to group all 1's present in the array together at any location. 泥板只剩我不看解答不會寫了 題目沒有要求要實際換出來 只要計算需要交換的數量 所以就是找一坨1最大坨的地方當最終目標 然後看裡面有幾個0需要被丟出去換1進來 話說都是1是要開鬥劍大會ㄇ? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 73.173.211.221 (美國) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1722570249.A.4B0.html

08/02 11:44, 1年前 , 1F
大師
08/02 11:44, 1F

08/02 14:56, 1年前 , 2F
大師
08/02 14:56, 2F
文章代碼(AID): #1ch5O9Im (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1ch5O9Im (Marginalman)