原创 24. 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

原创 50.Pow(x,n)

求x的冪次方Implement pow(x, n). 二分法 注意-n 轉化爲n的時候溢出,需要處理一下 class Solution {//超時用不了 public: double myPow(double x, int n) {

原创 33. Search in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0

原创 119. Pascal's Triangle II

Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1]. 這就是楊輝三角 cla

原创 236. Lowest Common Ancestor of a Binary Tree

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition

原创 C語言字符串strlen函數使用

計算字符串長度 以及自己實現一個strlen的函數 用法 #include<string.h> #include <stdio.h> #include <assert.h> #include <string.h> typede

原创 歡迎使用CSDN-markdown編輯器

歡迎使用Markdown編輯器寫博客 本Markdown編輯器使用StackEdit修改而來,用它寫博客,將會帶來全新的體驗哦: Markdown和擴展Markdown簡潔的語法 代碼塊高亮 圖片鏈接和圖片上傳 LaTex數學公式 UM

原创 1.Two Sum

1.Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You

原创 337 leetcode House Robber III

337 leetcode House Robber III The thief has found himself a new place for his thievery again. There is only one entranc

原创 字符串以爲包含問題

char src[] = "AABBCD"; char des[] = "CDAA"; 如上兩個字符串,則輸出true #include <stdio.h> #include <assert.h> #include <string

原创 Max Sum of Rectangle No Larger Than K

對於一維數組求最大的和並且不大於K 對於二維數組,轉化爲一維的迭代 代碼: class Solution { public: int maxSumSubmatrix(vector<vector<int>>& matrix,

原创 326. Power of Three LeetCode解題報告

Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using a