- 题目: 字符串之找到字符串的最大无重复字符子串 举例: str = "adcd" return 4 str = "aabcd" I know this str is 'adc' so return 3 要求: 时间复杂度为O(N) 代码实现: package com.chenyu.string.cn; public cl... 题目: 字符串之找到字符串的最大无重复字符子串 举例: str = "adcd" return 4 str = "aabcd" I know this str is 'adc' so return 3 要求: 时间复杂度为O(N) 代码实现: package com.chenyu.string.cn; public cl...
- 1、题目 Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by... 1、题目 Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by...
- 1 问题 反向打印链表值 2 思考 1) 我们利用栈的思想,新进后出,把链表的每个元素分别入栈之后再打印栈 2)既然上面用到了栈,我们应该就会想到用到递归来实现 3 代码实现 #include &l... 1 问题 反向打印链表值 2 思考 1) 我们利用栈的思想,新进后出,把链表的每个元素分别入栈之后再打印栈 2)既然上面用到了栈,我们应该就会想到用到递归来实现 3 代码实现 #include &l...
- 1、联合体的特点和大小 union是共用一个内存首地址,联合体中每个成员的地址都相同,等于联合体变量的首地址 联合体的大小足够容纳最宽的成员,大小能被其包含的所有基本数据类型的大小所整除 2、测试Demo #include <stdio.h> union var { long i... 1、联合体的特点和大小 union是共用一个内存首地址,联合体中每个成员的地址都相同,等于联合体变量的首地址 联合体的大小足够容纳最宽的成员,大小能被其包含的所有基本数据类型的大小所整除 2、测试Demo #include <stdio.h> union var { long i...
- 目录 前言创建枚举迭代枚举比较枚举enum.IntEnum 唯一枚举值代码中创建枚举 前言 之所以博主思考再三,开设一个数据结构的基础冷门课程。是因为目前大多数数据结构的书籍都使用的是C/C++,无疑增加了学习的门槛。 而python语言相对来说,更容易入门掌握,通过python学习数据结构与算法,对于初学者似乎更加的友好。 本篇,首先介绍的是枚... 目录 前言创建枚举迭代枚举比较枚举enum.IntEnum 唯一枚举值代码中创建枚举 前言 之所以博主思考再三,开设一个数据结构的基础冷门课程。是因为目前大多数数据结构的书籍都使用的是C/C++,无疑增加了学习的门槛。 而python语言相对来说,更容易入门掌握,通过python学习数据结构与算法,对于初学者似乎更加的友好。 本篇,首先介绍的是枚...
- package com.zuo.linkedlist; import java.util.Stack; import com.zuo.linkedlist.Josephuskill2.Node; /** * 题目:给定一个头结点,判断该链表是否回文结构 * 例如: * 1->2->1 true * 1->2->2->1 true * 1->... package com.zuo.linkedlist; import java.util.Stack; import com.zuo.linkedlist.Josephuskill2.Node; /** * 题目:给定一个头结点,判断该链表是否回文结构 * 例如: * 1->2->1 true * 1->2->2->1 true * 1->...
- 1、题目 数据结构之求二叉树的所有叶子和以及叶子总数 2、代码实现 tree.java package leetcode.chenyu.test; public class Tree { int val; Tree left; Tree r... 1、题目 数据结构之求二叉树的所有叶子和以及叶子总数 2、代码实现 tree.java package leetcode.chenyu.test; public class Tree { int val; Tree left; Tree r...
- 1、题目 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return in... 1、题目 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return in...
- 1、问题 C++字符串的切割 2、代码 #include <iostream>#include <string>#include <vector> std::vector<std::string> splite(const std::string &value, const std... 1、问题 C++字符串的切割 2、代码 #include <iostream>#include <string>#include <vector> std::vector<std::string> splite(const std::string &value, const std...
- The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 ... The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 ...
- 01背包问题具体例子: 假设现有容量10kg的背包,另外有3个物品,分别为a1,a2,a3。物品a1重量为3kg,价值为4;物品a2重量为4kg,价值为5;物品a3重量为5kg,价值为6。将哪些物品放入背包可使得背包中的总价值最大? 这个问题有两种解法,动态规划和贪婪算法。本文仅涉及动态规划。 先不套用动态规划的具体定义,试着想,碰见这种题目,怎么解决? ... 01背包问题具体例子: 假设现有容量10kg的背包,另外有3个物品,分别为a1,a2,a3。物品a1重量为3kg,价值为4;物品a2重量为4kg,价值为5;物品a3重量为5kg,价值为6。将哪些物品放入背包可使得背包中的总价值最大? 这个问题有两种解法,动态规划和贪婪算法。本文仅涉及动态规划。 先不套用动态规划的具体定义,试着想,碰见这种题目,怎么解决? ...
- 字符串常量,放在哪个存储区呢?是“自动存储区”还是“静态存储区”中? 比如: char *pstr="hello world!"; 这里,"hello world!"是一个字符串常量, pstr是在栈中的变量。 我想问,字符串常量,在哪个内存区域分配空间呢? 好像应该不是在“栈区“分配空间吧!!! 一、预备知识—程序的内存... 字符串常量,放在哪个存储区呢?是“自动存储区”还是“静态存储区”中? 比如: char *pstr="hello world!"; 这里,"hello world!"是一个字符串常量, pstr是在栈中的变量。 我想问,字符串常量,在哪个内存区域分配空间呢? 好像应该不是在“栈区“分配空间吧!!! 一、预备知识—程序的内存...
- 题目: 给定一个字符串数组strs, 再给定两个字符串str1和str2,返回在strs中str1和str2的最小距离,如果str1和str2为null,或者不再strs中,都返回-1 列如: strs = {"1","3","3","2","3","1","3"} ,str1 = "1" str2 = "2" 返回2 strs = {"CD"},st... 题目: 给定一个字符串数组strs, 再给定两个字符串str1和str2,返回在strs中str1和str2的最小距离,如果str1和str2为null,或者不再strs中,都返回-1 列如: strs = {"1","3","3","2","3","1","3"} ,str1 = "1" str2 = "2" 返回2 strs = {"CD"},st...
- 深度优先搜索 可以这样理解,向四边延伸搜索,然后遇到不能搜索的时候就回退,也就是回溯思想,然后再去其它可能地方搜索。 题目: 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, &nb... 深度优先搜索 可以这样理解,向四边延伸搜索,然后遇到不能搜索的时候就回退,也就是回溯思想,然后再去其它可能地方搜索。 题目: 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, &nb...
- 1、先看我的测试Demo #include <stdio.h>#include <stdlib.h> int get_size(int *p){ int size = sizeof(p); return size;} int main(){ int a[6] = {1, 2, 3, 4, 5, 6}; int b[] = {1, 2, 3, 4... 1、先看我的测试Demo #include <stdio.h>#include <stdlib.h> int get_size(int *p){ int size = sizeof(p); return size;} int main(){ int a[6] = {1, 2, 3, 4, 5, 6}; int b[] = {1, 2, 3, 4...
上滑加载中
推荐直播
-
华为云鸿蒙应用入门级开发者认证
2025/06/11 周三 16:00-17:30
Skye / 华为云学堂技术讲师
本次直播专为备考华为云鸿蒙端云应用入门级开发者认证的学员设计,提供系统的考试辅导。深度解析认证核心知识点,涵盖HarmonyOS介绍、应用开发入门、ArkTS语言、声明式开发范式组件、Stage应用模型、玩转服务卡片、鸿蒙应用网络请求开发、鸿蒙应用云函数调用等内容。
回顾中 -
基于昇腾NPU的合成孔径雷达成像案例
2025/06/12 周四 19:00-20:00
李阳 华为开发者布道师-高校教师
介绍合成孔径雷达算法的原理和优势,了解合成孔径雷达在传统计算中的痛点,分享如何使用昇腾NPU和AscendC语言构建信号处理算子,如何助力信号处理领域的高性能计算。
回顾中 -
华为云GaussDB入门级认证 - 考试辅导
2025/06/13 周五 16:00-17:30
Steven / 华为云学堂技术讲师
本次直播为HCCDA-GaussDB认证考试提供全面辅导,旨在帮助学员深入了解数据库技术原理与应用实践。我们将详细解析考试大纲,分享高效备考策略,并讲解关键知识点,包括但不限于SQL操作介绍、GaussDB数据库管理与运维基础等。
回顾中
热门标签