![](https://img-blog.csdnimg.cn/20210110231002419.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
C语言
C语言学习
d_benhua
这个作者很懒,什么都没留下…
展开
-
LeetCode 21. Merge Two Sorted Lists(合并两个有序链表) -- c语言
21. Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->...原创 2019-05-24 22:33:10 · 253 阅读 · 0 评论 -
Leetcode 724. Find Pivot Index(寻找数组的中心索引) -- c语言
724. Find Pivot IndexGiven an array of integersnums, write a method that returns the "pivot" index of this array.We define the pivot index as the index where the sum of the numbers to the left of...原创 2019-05-21 10:52:02 · 423 阅读 · 0 评论 -
Leetcode 61. Rotate List(旋转链表) -- c语言
61. Rotate ListGiven a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->...原创 2019-05-20 11:42:42 · 313 阅读 · 0 评论 -
LeetCode 26. Remove Duplicates from Sorted Array(删除排序数组中的重复项) -- C语言
26. Remove Duplicates from Sorted ArrayGiven a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for a...原创 2019-05-20 10:37:03 · 200 阅读 · 0 评论 -
LeetCode 142. Linked List Cycle II(环形链表II) -- c语言
142. Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linked list, we use an integer pos which rep...原创 2019-05-17 23:18:17 · 309 阅读 · 0 评论 -
LeetCode 344. Reverse String(反转字符串) -- c语言
344.Reverse StringWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".解题方法1:定义一个指针数组,通过赋值进行反转操作执行时间 8mschar* reverseSt...原创 2018-06-16 20:09:44 · 434 阅读 · 0 评论 -
LeetCode 2. Add Two Numbers(两数相加)--c语言
2. Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two ...原创 2019-06-07 21:30:38 · 283 阅读 · 0 评论 -
LeetCode 82. Remove Duplicates from Sorted List II(删除排序链表中的重复元素 II)--c语言
82. Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2-&...原创 2019-06-07 23:11:22 · 241 阅读 · 0 评论 -
LeetCode 237. Delete Node in a Linked List(删除链表中的结点) -- c语言
237. Delete Node in a Linked ListWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Given linked list --head =[4,5,1,9], which looks like...原创 2019-06-07 23:44:53 · 403 阅读 · 0 评论 -
LeetCode 876. Middle of the Linked List(链表的中间结点) -- c语言
876. Middle of the Linked ListGiven a non-empty, singlylinked list with head node head, returnamiddle node of linked list.If there are two middle nodes, return the second middle node.Example ...原创 2019-06-08 00:00:39 · 243 阅读 · 0 评论 -
LeetCode 92. Reverse Linked List II(反转链表II) -- c语言
92. Reverse Linked List IIReverse a linked list from positionmton. Do it in one-pass.Note:1 ≤m≤n≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output...原创 2019-06-03 00:17:13 · 223 阅读 · 0 评论 -
LeetCode 147. Insertion Sort List(对链表进行插入排序)--c语言
147. Insertion Sort ListSort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.With ...原创 2019-06-09 15:42:31 · 270 阅读 · 0 评论 -
LeetCode 148. Sort List(排序链表)--c语言
148. Sort ListSort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->...原创 2019-06-09 17:20:11 · 469 阅读 · 0 评论 -
LeetCode 1019. Next Greater Node In Linked List(链表中的下一个更大节点)--c语言
1019. Next Greater Node In Linked ListWe are given a linked list withheadas the first node.Let's number thenodes in the list: node_1, node_2, node_3, ... etc.Each node may have a next larger ...原创 2019-06-09 21:21:00 · 380 阅读 · 0 评论 -
LeetCode 143. Reorder List(重排链表)--c语言
143. Reorder ListGiven a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example...原创 2019-06-06 23:22:52 · 563 阅读 · 0 评论 -
LeetCode 24. Swap Nodes in Pairs(两两交换链表中的结点)--c语言
24. Swap Nodes in PairsGiven alinked list, swap every two adjacent nodes and return its head.You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example:Given...原创 2019-06-04 23:35:33 · 190 阅读 · 0 评论 -
中缀表达式转化成后缀表达式并计算结果
#include<stdio.h>#include<stdlib.h>#define MaxSize 1024void print(char *postexp){ while(*postexp != '\0'){ printf("%c",*postexp); postexp++; } printf("\n")...原创 2019-06-24 20:06:26 · 316 阅读 · 0 评论 -
LeetCode 747. Largest Number At Least Twice of Others(至少是其他数字两倍的最大数) -- C语言
747. Largest Number At Least Twice of OthersIn a given integer arraynums, there is always exactly one largest element.Find whether the largest element in the array is at least twice as much as ev...原创 2019-05-21 11:21:23 · 205 阅读 · 0 评论 -
LeetCode 66. Plus One(加一) -- c语言
66. Plus OneGiven anon-emptyarray of digitsrepresenting a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, an...原创 2019-05-21 11:42:05 · 229 阅读 · 0 评论 -
LeetCode 234. Palindrome Linked List(回文链表) -- c语言
234. Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:C...原创 2019-05-25 00:53:01 · 339 阅读 · 0 评论 -
LeetCode 118. Pascal's Triangle(杨辉三角) -- c语言
118. Pascal's TriangleGiven a non-negative integernumRows, generate the firstnumRowsof Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly above it.Exa...原创 2019-05-21 23:10:01 · 834 阅读 · 0 评论 -
LeetCode 119. Pascal's Triangle II(杨辉三角II) -- c语言
119. Pascal's Triangle IIGiven a non-negativeindexkwherek≤33, return thekthindex row of the Pascal's triangle.Note that the row index starts from0.In Pascal's triangle, each number is ...原创 2019-05-22 00:31:47 · 350 阅读 · 0 评论 -
LeetCode 7.Reverse Integer(整数反转) -- c语言
7.Reverse IntegerGiven a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note...原创 2019-05-22 22:31:49 · 179 阅读 · 0 评论 -
LeetCode 344.Reverse String(反转字符串) -- c语言
344.Reverse StringWrite a function that reverses a string. The input string is given as an array of characterschar[].Do not allocate extra space for another array, you must do this bymodifying t...原创 2019-05-22 23:01:00 · 261 阅读 · 0 评论 -
LeetCode 387. First Unique Character in a String(字符串中的第一个唯一字符) -- c语言
387.First Unique Character in a StringGiven a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = ...原创 2018-06-16 20:37:22 · 935 阅读 · 0 评论 -
LeetCode 328. Odd Even Linked List(奇偶链表) -- C语言
Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You shou...原创 2019-05-19 23:39:18 · 462 阅读 · 0 评论 -
LeetCode 19. Remove Nth Node From End of List(删除链表的倒数第N个结点) -- c语言
19. Remove Nth Node From End of ListGiven a linked list, remove then-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After re...原创 2019-05-23 23:23:07 · 184 阅读 · 0 评论 -
LeetCode 206. Reverse Linked List(反转链表) -- c语言
206. Reverse Linked ListReverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be reversed eit...原创 2019-05-23 23:54:15 · 303 阅读 · 0 评论 -
LeetCode 141. Linked List Cycle(环形链表) -- c语言
141. Linked List CycleGiven a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integerposwhich represents the position (0-indexed)in the l...原创 2019-05-30 22:53:22 · 247 阅读 · 0 评论 -
LeetCode 160. Intersection of Two Linked Lists(相交链表) -- c语言
160. Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to intersect...原创 2019-05-31 00:46:27 · 330 阅读 · 0 评论 -
LeetCode 83. Remove Duplicates from Sorted List(删除排序链表中的重复元素) -- c语言
83. Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.Example 1:Input: 1->1->2Output: 1->2Example 2:In...原创 2019-05-31 10:55:52 · 307 阅读 · 0 评论 -
LeetCode 86. Partition List(分隔链表)--c语言
86. Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the original relative order of t...原创 2019-06-06 22:53:43 · 599 阅读 · 0 评论 -
LeetCode 203. Remove Linked List Elements(移除链表元素) -- c语言
203. Remove Linked List ElementsRemove all elements from a linked list of integers that have valueval.Example:Input: 1->2->6->3->4->5->6, val = 6Output: 1->2->3->4...原创 2019-05-31 22:38:57 · 189 阅读 · 0 评论 -
LeetCode 707. Design Linked List(设计链表) -- c语言
707. Design Linked ListDesign yourimplementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singlylinked list should have two attribute...原创 2019-05-31 23:17:55 · 526 阅读 · 0 评论 -
LeetCode 27.Remove Element(移除元素) -- c语言
27.Remove ElementGiven an arraynumsand a valueval, remove all instances of that valuein-placeand return the new length.Do not allocate extra space for another array, you must do this bymodif...原创 2019-05-31 23:36:48 · 250 阅读 · 1 评论 -
LeetCode编码基础知识
c标准库:https://www.runoob.com/cprogramming/c-standard-library-assert-h.htmlpow()函数: 计算a的x次方并返回给result用法:#include<math.h>result = pow(a,x);Qusetion:得出一个整数x的digit(位数)。Example:x = ...原创 2019-06-01 00:27:50 · 724 阅读 · 0 评论 -
字符串模式匹配
#include<stdio.h>#include<stdlib.h>#define MaxSize 10void Next(char* t,int next[]){ int i = 0; int k = -1;//用于next[]的下标 next[0] = -1;//初始化第一位为-1 while(t[i] != '\0...原创 2019-06-24 20:47:18 · 102 阅读 · 0 评论