ICode9

精准搜索请尝试: 精确搜索
  • 回溯算法2022-06-19 15:32:25

    回溯算法是一种比较有用的算法工具.能够帮助我们解决三种问题:组合,子集,棋盘. 也许业务中有很多种不同的问题,基本都可以归类为这三种问题. 回溯问题可以理解为是一个回溯树,如果有一些问题没有解题思路,可以画出回溯树来帮助我们. 当在每一个节点的时候,都有两个选项:选择区间(

  • BLOG_32022-06-19 00:00:43

    (1)前言:本次BLOG主要对过去几周的内容做一个总结,主要是分三次作业做了一个电信计费项目。   1.第一次:经过前面图形判断的非常不人性化折磨,对于本次的错误格式判断有了更深的理解,    2.第二次:第二次题目在题量与数据界定上都友好了许多,没有那么多另人懵逼的测试点,难度相比第一

  • leetcode 64. Minimum Path Sum 最小路径和(中等)2022-06-18 23:01:00

    一、题目大意 标签: 动态规划 https://leetcode.cn/problems/minimum-path-sum 给定一个包含非负整数的 m x n 网格 grid ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。 说明:每次只能向下或者向右移动一步。 示例 1: 输入:grid = [[1,3,1],[1,5,1],[4,2,1]]

  • 插入排序2022-06-18 17:33:22

    插入排序思路 利用抓牌的思路去想 从后面插入方式 // 从后向前比较的情况 function insert(array) { // 先准备一个空数组 拿牌 let handle = []; // 先拿到第一张 这个是必须要有一张 需要下面循环的时候拿到一个进行比较 handle.push

  • 括号匹配2022-06-18 14:35:09

      #include<iostream>//用栈实现(是否匹配 using namespace std;   class SqStack { private: char* base; int stacksize; public: int top; SqStack(int m); void Push(char x); char Pop(); char Top(); };   SqStack::SqStack(int  m) { base = new char [m]; if (base =

  • 练习题之山脉峰顶索引2022-06-18 14:04:22

    思路: 大概意思就是找到数组递增又递减的中间那个值的索引; 或者是递增结束后最后一个值的索引; 或者是数组最大值的索引(这个思想只能用在纯山峰型数组中); 题目: 符合下列属性的数组 arr 称为 山脉数组 : arr.length >= 3 存在 i(0 < i < arr.length - 1)使得: arr[0] < arr[1] < ... ar

  • .NET Core 企业微信回调配置2022-06-17 14:32:18

    1.配置API接收    2.下载加密解密库     地址:https://developer.work.weixin.qq.com/devtool/introduce?id=36388,也可以复制下面的代码 2.1 WXBizMsgCrypt.cs    该方法封装了VerifyURL, DecryptMsg, EncryptMsg三个接口,分别用于开发者验证回调url,收到用户回复消息的解密

  • js 手写随机数组 洗牌算法 数组乱序2022-06-17 14:31:29

    取最后一张,随机得到0~length-1的索引,与第一张交换位置 取导出第二张,随机得到0~length-1-1的索引,与第二张交换位置 以此类推 取导出第i张,随机得到0~length-i-1的索引,与第i张交换位置 const shuffle = arr => { const len = arr.length for (let i = 0; i < len

  • Day19 字符串匹配2022-06-17 13:33:03

    1.这个是朴素模式匹配算法,从主串头开始,依次选取和模式串等长的子串,挨个字符匹配,如果匹配失败就检索下一个子串。 2.匹配第一个字符的长度是 length - paraMyString.length + 1。比如主串是ABCDE,模式串是ACB,这里的第一个循环就应该比对 5 - 3 + 1 = 3次。如果第一个字符匹配就依次

  • 14.矩阵置零2022-06-17 08:00:35

    73. 矩阵置零 给定一个 m x n 的矩阵,如果一个元素为 0 ,则将其所在行和列的所有元素都设为 0 。请使用 原地 算法。   示例 1: 输入:matrix = [[1,1,1],[1,0,1],[1,1,1]] 输出:[[1,0,1],[0,0,0],[1,0,1]] 示例 2: 输入:matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]] 输出:[[0,0,0,0]

  • pydantic模型配置2022-06-16 12:36:16

    1.配置参数 title:生成的 JSON 架构的标题 anystr_strip_whitespace:是否去除 str 和字节类型的前导和尾随空格(默认值:False) anystr_lower:是否使 str 和字节类型的所有字符都小写(默认值:False) min_anystr_length:str & byte 类型的最小长度(默认值:0) max_anystr_length:str & byte 类

  • js无重复字符串最长子串2022-06-16 00:04:12

    /* eg: abcabcbb---3 */ var lengthOfLongestSubstring=function(s){ const set =new Set(); let i=0;j=0;maxLength=0; if(s.length===0){ return 0 } for(i;is.length;i++){ if(!set.has(s[i])){//没有重复的情况 set.add(s[i])

  • LeetCode 2090. K Radius Subarray Averages2022-06-15 12:03:14

    原题链接在这里:https://leetcode.com/problems/k-radius-subarray-averages/ 题目: You are given a 0-indexed array nums of n integers, and an integer k. The k-radius average for a subarray of nums centered at some index i with the radius k is the a

  • 克鲁斯卡尔算法-公交站问题2022-06-15 06:31:06

    1.背景 2.代码 package com.ldp.algorithm.demo05Kruskal; import org.junit.Test; import java.util.Arrays; /** * @create 06/14 9:04 * @description <P> * 克鲁斯卡尔算法-公交站问题 * 1.找出所有边 * 2.对边按照权值排序 * 3.从小到大加入边(要求加入时不构成回

  • js 手写promise.all2022-06-14 16:04:17

    入参必须实现iterator接口,一般为数组 全部成功才算成功,有一个失败就失败, 如果成功,结果顺序和入参顺序保持一致 返回一个新的promise, Promise._all = function (promises) { if (!promises instanceof Array) throw 'promises must be an array' const len

  • 团队冲刺082022-06-14 08:01:46

    增加了忘记密码,移除密码的功能,进行密保验证。 代码: @SuppressLint("CommitPrefEdits") private void updatePassword (String passwordText, String questionText, String answerText) { if (passwordText == null) { if (prefs.getString(PREF_PASSWORD, "")

  • LeetCode 17. Letter Combinations of a Phone Number2022-06-13 22:37:07

    LeetCode 17. Letter Combinations of a Phone Number (电话号码的字母组合) 题目 链接 https://leetcode.cn/problems/letter-combinations-of-a-phone-number/ 问题描述 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字

  • 数据与结构-顺序表2022-06-13 22:04:51

    #include<stdio.h> #include<stdlib.h> #define MAXSIZE 20 typedef int ElemType; typedef struct { ElemType elem[MAXSIZE]; int length; }SeqList;//定义一个顺序表 SeqList *L; //初始化顺序表 void init_SeqList(SeqList *L) { L->length=0;//长度为0,顺序表自

  • js冒泡、选择、插入排序2022-06-13 20:00:30

    排序算法可以分为内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存。常见的内部排序算法有:插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等 数组排序的

  • 如何对数组进行排序?2022-06-13 15:03:33

    我们有一个需要排序的数组: let arr = [86, 24, 64, 48, 15, 30, 90, 49]     首先,定义一个参数为数组的快速排序函数。 var quickSort = function(arr) {}; 然后,检查数组中的元素个数,如果小于等于 1,则返回。 var quickSort = function(arr) { if (arr.length <= 1) { return a

  • string match 字符串匹配2022-06-13 03:00:43

    214. Shortest Palindrome Hard You are given a string s. You can convert s to a palindrome by adding characters in front of it. Return the shortest palindrome you can find by performing this transformation.  Example 1: Input: s = "aacecaaa" O

  • LeetCode No63. 不同路径 II2022-06-12 23:00:46

    题目 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为 “Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为 “Finish”)。 现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径? 网格中的障碍物和空位置

  • 判断字符串是否为回文字符串2022-06-12 17:02:57

    方法一 function isStr(str){ if(!str.length) return false; str = str.toLowerCase().split(''); let start = 0; let end = str.length - 1; while(start<end){ if(str[start] === str[end]){ start++; end--; }else{ return false } } re

  • C#学习17————复习(常量、枚举、数组、冒泡、方法)2022-06-12 10:32:37

    #region 复习 /* 常量:一旦赋值,不能被重新赋值; 枚举:规范开发; 结构:为了一次性声明多个不同类型的变量(实际为字段); 数组:为了一次性声明多个相同类型的变量 通过下标或索引访问数组中元素 数组的取值和赋值 冒泡排序:两个for循环

  • [LintCode] 194. Find Words2022-06-12 08:32:48

    Given a string str and a dictionary dict, you need to find out which words in the dictionary are subsequences of the string and return those words.The order of the words returned should be the same as the order in the dictionary. |str|<=1000 the su

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有