原创 leetcode: (9) Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space. 方法一:首先求出x一共有多少位,然後從比最低位與最高位的值開始比較 低位的值可以通過 x

原创 華爲oj: 字符串最後一個單詞的長度

描述 計算字符串最後一個單詞的長度,單詞以空格隔開。 知識點 字符串,循環 運行時間限制 0M 內存限制 0 輸入 一行字符串,長度小於128。 輸出 整數N,最後一個單詞的長度。 樣例輸入 hel

原创 C/C++, 字符庫函數

頭文件#include <ctype.h> 、#include <cctype> 1. bool  isalnum(char  c) 判斷一個字符是否爲字母或數字 2. bool isalpha(char c) 判斷一個字符是否爲

原创 華爲oj: 字符串反轉

描述 寫出一個程序,接受一個字符串,然後輸出該字符串反轉後的字符串。例如: 知識點 數組,指針 運行時間限制 10M 內存限制 128 輸入 輸入N個字符 輸出 輸出該字符串反轉後的字符串 樣例輸入

原创 華爲oj: 輸入n個整數,輸出其中最小的k個

述 輸入n個整數,輸出其中最小的k個。詳細描述:接口說明原型:bool GetMinK(unsignedint uiInputNum, int * pInputArray, unsignedint uiK, int * pOutpu

原创 華爲oj : 挑7

描述 輸出7有關數字的個數,包括7的倍數,還有包含7的數字(如17,27,37...70,71,72,73...)的個數 知識點 循環 運行時間限制 0M 內存限制 0 輸入 一個正整數N。(N不大於30000)

原创 leetcode: (27) Remove Element

【Question】 Given an array and a value, remove all instances of that value in place and return the new length. The or

原创 leetcode: (125) Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For exa

原创 華爲oj: 圖片整理

描述 Lily上課時使用字母數字圖片教小朋友們學習英語單詞,每次都需要把這些圖片按照大小(ASCII碼值從小到大)排列收好。請大家給Lily幫忙,通過C語言解決。  知識點 字符串 運行時間限制 0M 內存限制 0

原创 leetcode: (205) Isomorphic Strings

Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be

原创 leetcode: (88) Merge Sorted Array

【Question】 Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You ma

原创 leetcode: (119) Pascal's Triangle II

【Question】 Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]

原创 leetcode: (219) Contains Duplicate II

【Question】 Given an array of integers and an integer k, find out whether there are two distinct indices i and j in th

原创 leetcode: (118) Pascal's Triangle

【Question】 Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [

原创 鏈表的基本操作

C/C++ 首先,用結構體創建節點 struct ListNode { int val; ListNode* next; };一、初始化操作 第1種,不返回的情況 void InitList1(ListNode **