原文地址:https://www.cnblogs.com/AnAng/p/9370913.html 目录 目录 1 IGame游戏公司的故事 1.1 讨论会 1.2 实习生小李的实现方法 1.3 架构师的建议 1.4 小李的小结 2 探究依赖注入 2.1 故事的启迪 2.2 正式定义依赖注入 3 依 ...
分类:
Web程序 时间:
2021-02-18 13:13:24
阅读次数:
0
快速排序是用的比较多的排序算法,比如需要对“6 1 2 7 9 3 4 5 10 8”这几个数进行排序。方法是首先在这个序列中随便找一个数作为基准数。比如找 6 作为基准数, 然后需要将这个序列中所有比基准数 6 大的数放右边,比基准数小的数放 6 的左边,类似如下排列: 初始的状态下数字 6 在序 ...
分类:
编程语言 时间:
2021-02-18 13:11:13
阅读次数:
0
1. 题目描述 You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, whi ...
分类:
编程语言 时间:
2021-02-18 13:08:31
阅读次数:
0
1. 题目描述 Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. 2. Examples 示例1: Input ...
分类:
编程语言 时间:
2021-02-18 13:07:50
阅读次数:
0
请实现一一个函数,输入一个整数,输出该数二进制表示中1的个数。 例: 9的二进制表示为1001,有2位是1 import java.util.Scanner; public class _03_1的个数 { public static void main(String[] args) { Scann ...
分类:
编程语言 时间:
2021-02-18 13:03:18
阅读次数:
0
思路1: 暴力枚举。 实现1: 1 class Solution 2 { 3 public: 4 int findKthPositive(vector<int>& arr, int k) 5 { 6 int n = arr.size(); 7 vector<int> cnt(2001, 0); 8 ...
分类:
其他好文 时间:
2021-02-18 12:54:30
阅读次数:
0
前言: 本文参考《信息学奥赛一本通·金牌导航》。 正文: Manacher 算法: 概念: Manacher 算法,经常被称作马拉车,可以以 \(\mathcal{O}(n)\) 的时间复杂度求出字符串关于回文子串一类的问题。 介绍: 首先举个例子,设字符串 \(s=\texttt{bbdkd}\) ...
分类:
编程语言 时间:
2021-02-17 15:06:24
阅读次数:
0
考虑边分治。 边分治的时候考虑跨过中心边的点对 \((x,y)\) 的答案。考虑到 \(d_x+d_y-d_{lca(x,y)}\) 其实是 \(\frac{1}{2}(dix(x,y)+d_x+d_y)\) ,这下就跟 \(lca\) 没关系了。 显然在边分治的过程中 \(dis(x,y)\) 也 ...
分类:
其他好文 时间:
2021-02-17 14:59:55
阅读次数:
0
此博客链接:https://www.cnblogs.com/ping2yingshi/p/14402948.html 石子游戏 题目链接:https://leetcode-cn.com/problems/stone-game/ 题目 亚历克斯和李用几堆石子在做游戏。偶数堆石子排成一行,每堆都有正整数 ...
分类:
其他好文 时间:
2021-02-17 14:57:21
阅读次数:
0
https://www.acwing.com/problem/content/1145/ 思路 \(把已有的边加上,会形成各个连通块,等价于把每个连通块当成一个点去做Kruskal算法.\) #include <bits/stdc++.h> using namespace std; #define ...
分类:
其他好文 时间:
2021-02-17 14:56:41
阅读次数:
0