原创 彙編語言學習第九章-轉移指令的原理

本博文系列參考自<<彙編語言>>第三版,作者:王爽 可以修改IP寄存器的值,或者同時修改CS與IP的值的指令稱爲轉移指令。轉移指令的功能就是使得CPU執行內存中某段特定的指令或程序。 8086CPU的轉移行爲分爲如下幾類; 1.只改變I

原创 LeeCode-Pow(x, n)

Implement pow(x, n). double myPow(double x, int n) { if(n==0) return 1.0; if(n<0) retur

原创 LeeCode-Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2

原创 LeeCode-Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n 

原创 LeeCode-Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6

原创 LeeCode-Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum s

原创 LeeCode-Remove Element

Given an array and a value, remove all instances of that value in place and return the new length. The order of eleme

原创 LeeCode-Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should retu

原创 LeeCode-Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, wi

原创 LeeCode-Insertion Sort List

Sort a linked list using insertion sort. /** * Definition for singly-linked list. * struct ListNode { * int val

原创 LeeCode-Power of Two

Given an integer, write a function to determine if it is a power of two. bool isPowerOfTwo(int n) { if(n<=0)

原创 LeeCode-Single Number II

Given an array of integers, every element appears three times except for one. Find that single one. int singleNumber(i

原创 LeeCode-Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume tha

原创 LeeCode(Database)-Combine Two Tables

Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int |

原创 LeeCode-Rotate Array

Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] i