- 博客(5)
- 收藏
- 关注
原创 leetcode_19. Remove Nth Node From End of List
题目描述:Given the head of a linked list, remove the nth node from the end of the list and return its head.Follow up: Could you do this in one pass?Example 1:Input: head = [1,2,3,4,5], n = 2Output: [1,2,3,5]Example 2:Input: head = [1], n = 1Output: []
2021-01-21 09:54:11
103
原创 Leetcode_2.Add Two Numbers
题目描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.You may assume the two n
2021-01-20 15:34:33
118
原创 C语言八皇后问题
八皇后算法:规定每行放置一个皇后,从第一列开始逐个放1.flag[col]表示n列能否放置皇后,1表示可以放置,0表示无法放置;2.place[row]表示第row行放置的皇后列号;3.d1[0…14]为(row,col)的上对角线是否被占领,row-col+7相同的在同一对角线,1表示可以被占领,0表示不可以;4.d2[0…14]同理为下对角线,row+col相同的在同一次对角线上对角线图d1[row-col+7]等效于d1[0…14],将图中的负值转化为正值,构造成同一数组,从而相同值
2021-01-04 15:51:16
487
原创 整数转字符串的C语言实现
算法思路:逆序将整数单个位数转换成字符赋值进入数组,此时得到一个逆序的字符串数组,最后要加’\0’结束符;输出时逆序输出,或者逆置字符串数组再输出也可以得到结果;#include<stdio.h>#include<string.h>void itoa(int num, char str[100]) { int i = 0; do { str[i] = num % 10 + '0'; num /= 10; i++; } while (num); str
2021-01-02 23:27:42
6096
原创 数据结构之单链表基本操作——C语言
数据结构之单链表基本操作——C语言实现#include<stdio.h>#include<stdlib.h>#define NULL ((void *)0)//链表数据结构(带有头结点)//方法包括:链表的创建,增查删,求链表长度typedef int ElemType;//定义结构体typedef struct node{ ElemType dat...
2020-03-02 23:31:15
2258
4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人