offer-algorithm's People
offer-algorithm's Issues
乘积数组分析
1.关于乘积数组的分析需要再细化;
2.给出其他解决方案。
第5题:增加剑指offer第5题解法
第2题:解法1的详细分析
- 增加解法的分析。
第3题:增加非递归的解决方法
解法2:非递归方式
第四题:增加剑指offer第四题的题目
第5题:增加剑指offer第5题的题目和文件
第3题:增加剑指offer第三题的解法
- 增加剑指offer第三题的解法;
- 解法分析。
第4题:增加剑指offer第四题解法分析
分析
第3题:非递归解法分析
增加非递归解法的分析:
1.当n=1与n=2时,f(n) =1;
所以设置arr = [1, 1];
2. 当n >2时循环遍历,将值push到数组arr中
arr.push(arr[n-1] + arr[n-2]);
第4题:增加剑指offer第四题的解法
第5题:解法分析
【数组】求2个数组的交集
- 使用hash表的方式
intersection() {
const num1 = [1, 2, 3, 4, 5, 6];
const num2 = [5, 6, 6, 8, 10, 12];
let result = [];
let hashMap = {};
for (let i = 0; i < num1.length; i++) {
if (!hashMap[num1[i]]) {
hashMap[num1[i]] = true;
}
}
for (let j = 0; j < num2.length; j++) {
if (hashMap[num2[j]]) {
result.push(num2[j]);
hashMap[num2[j]] = false;
}
}
return result;
}
- 思路解析
- 首先遍历第一个数组,将数组中的值作为hash表的key,value设置为true;
- 遍历第二个数组,判断num2数组中的数字是否在hash表中,如果在则push到result中,并将其value设置为false.
第2题:增加一种解法+分析
- 给出一种解法;
- 并对给出的解法进行分析;
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.