Implication : After the reversion, numsi <= ... <= numsn-1. The next permutation of nums only change numsi-1: by swapping position of numsi-1 and first numsj greater than it behind it. Reference Solution
Keep Reading →
Implication : Remove the last value of current sequence while next number is less than it. Then the result sequence will be smallest one. If k > 0 at the end, it will also be in ascending order. Reference Solution
Keep Reading →
Implication : After day 1, cells0 and cells7 must be 0. So the total number of states is reduced from 2^8 to 2^6, which will save time and space. Reference Solution
Keep Reading →
Hint : It's modified lexicographic comparation.
Keep Reading →
Hint : Start delete after finding duplicated nodes, then delete last node (head) at last. Reference Solution
Keep Reading →
Implication : If we move the higher side inside, the area must be smaller. Reference Solution
Keep Reading →
Implication : First multiply the numbers literately from left side, then do it again from right side. Reference Solution First thought with O(n) space complexity : To improve, we can reuse the result array :
Keep Reading →
夏天即将过去,各位在这个暑假里一定收获不少,如果能有一个地方能够记录自己的学习的点滴,并将成果展示给其他访客,对于自己未来发展将会是极大的帮助。目前市面上有许多博客服务提供商,例如CSDN、简书、Medium等,只需要注册账号,我们就可以在这些网站上撰写自己的博客。在这些网站上,使用Markdown撰写博客,就能写出非常优雅的文章。但如果我们想更进一步,更加个性化地定制自己的主页,这时就需要考虑搭建自己的服务器了。如果网站以静态内容为主,我们有性价比更高的方案:Github Pages 和 Netlify 。 静态化网站的优点 性价比高 通常的动态网站分为前后端,后端的服务器在收到客户端访问请求后,通常需要执行对数据库的读写操作,然后将结果渲染成前端页面,返回给客户端。这一过程中,数据库读写和渲染页面都需要大量的计算资源,当访问量增长时,CPU…
Keep Reading →