文章 2023-07-11 来自:开发者社区

求链表的倒数第m个元素

描述:给你一个链表,链表长度为n,链表内各元素为$a1,a2…an,给你一个数m,求链表倒数第m个数是多少。#include<bits/stdc++.h> using namespace std; struct Node{ int Date; struct Node* next; }; int n,m; typedef struct Node* List;//建立链表 ...

文章 2017-12-01 来自:开发者社区

[CareerCup] 2.2 Kth to Last Element of Linked List 链表的倒数第k个元素

2.2 Implement an algorithm to find the kth to last element of a singly linked list. 这道题让我们求链表中倒数第k个元素,LeetCode中相类似的题目有Kth Largest Element in an Array 数组中第k大的数字 和 Kth Smallest Element in a BS...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

数据库

分享数据库前沿,解构实战干货,推动数据库技术变革

+关注