Muser

弱小和无知不是生存的障碍,傲慢才是


  • Home

  • About

  • Tags

  • Categories

  • Archives

  • Notes

  • Commonweal 404

LeetCode: Delete Node in a Linked List

Posted on 2017-01-12 | Last modified: 2017-10-20 | In LeetCode
Words count: 157
ProblemWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function. SolutionThe solution is a little tricky. Normally, when we delete a node from a linked list, we should know the previous node of the one we want to delete. However, at this time, we only ...
Read more »

LeetCode: Move Zeroes

Posted on 2017-01-12 | Last modified: 2017-10-20 | In LeetCode
Words count: 326
ProblemGiven an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0]. Note:You must do this in-place without making a copy of the array.Minimize the total number of operations. Solution 1 – 59msGo through the array. If ith element is 0, then move all elements within [i+1,nums,length-1] one place ahead, ...
Read more »

LeetCode: Sum of Two Integers

Posted on 2017-01-09 | Last modified: 2017-10-20 | In LeetCode
Words count: 167
Problem1234Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3. SolutionThink this problem with an example. Consider 15+9=24. 12345#XOR holds the remaining part of the result 00001111XOR 00001001------------- 00000110 12345#AND holds the carry part of the result 00001111AND 00001001------------- 00001001 12345# shift the carry to left for 1 place, and add with the remaining ...
Read more »

Customize hexo blogs

Posted on 2017-01-05 | Last modified: 2019-02-01 | In Hexo
Words count: 887
In my previous post, I introduced how to build personal blog site with the help of Hexo and Github Pages. Now it’s time to customize the hexo blog to show some personalities. _config.yml_config.yml is the configuration file of your hexo blog (in project root dir). Hexo lets you define your site information, customize date/time format, pagination behaviour, language settings, etc. Most configs are not necessary, but it will make your site look more like yours if you specify th ...
Read more »

Build blogs with Hexo!

Posted on 2017-01-05 | Last modified: 2019-02-01 | In Hexo
Words count: 403
Welcome to my blog! In this my very first post, I will record my experience of building this blog with the help of Github Pages and the amazing Hexo! This not only keeps a record of what I did, but also may help those who want to build a personal blog site. Ok, let’s get down to the business. Prerequisite Node.js Git Node.js and Git should be installed properly on your machine.If not, download Node.js and Git, then choose the version you want. Install Hexo1$ npm install -g ...
Read more »
1…1112
Muser

Muser

Coding While Thinking

60 posts
6 categories
67 tags
RSS
Search
© 2020 Muser | Site words count: 55.0k
Powered by Hexo
|
Theme — NexT.Muse