• 2024-06-17C. Lexicographically Largest
    原题链接题解1.第\(i\)个位置上的数,对\(S\)的贡献最大不会超过\(a_i+i\),我们令其为\(c_i\)2.我们不去细想如何操作才能得到最优解,而是去想第一大的\(b\)是多少?第二大的\(b\)是多少?3.对\(c_i\)降序排序得到\(b_i\),如果所有\(b_i\)都不同,那么直接输出即可。4.但
  • 2023-11-28Make Lexicographically Smallest Array by Swapping Elements
    MakeLexicographicallySmallestArraybySwappingElementsYouaregivena 0-indexed arrayof positive integers nums anda positive integer limit.Inoneoperation,youcanchooseanytwoindices i and j andswap nums[i] and nums[j] if |nums
  • 2023-03-31leetcode-744-easy
    FindSmallestLetterGreaterThanTargetYouaregivenanarrayofcharacterslettersthatissortedinnon-decreasingorder,andacharactertarget.Thereareatleasttwodifferentcharactersinletters.Returnthesmallestcharacterinlettersthatis
  • 2022-11-26C. Almost All Multiples
    C.AlmostAllMultiplesGiventwointegers$n$and$x$,apermutation$^{\dagger}$$p$oflength$n$iscalledfunnyif$p_i$isamultipleof$i$forall$1\l
  • 2022-10-09LeetCode 2434. Using a Robot to Print the Lexicographically Smallest String
    原题链接在这里:https://leetcode.com/problems/using-a-robot-to-print-the-lexicographically-smallest-string/题目:Youaregivenastring s andarobotthatcurr