今天开启leetcode 入门第一题 题意很简单,就是一个数组中求取两数之和等于目标数的一对儿下标 1.暴力 n^2 两个for循环遍历 用时0.1s 开外 代码就不用写了 2.二分 nlogn 我们可以遍历选择每一个元素 ,然后二分剩余(target - ai) (一)从全序列二分剩余 这就需要考虑下标和自己重叠的情况,比如[3,3],target:6 于是我们就需要判重叠 代码就长成下面这样了(8ms) class Solution { public: vector<int> twoSum…
题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. 翻译: 给定一组整数,两个数字的返回索引,它们的和会等于一个特定…
题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. 翻译: 给定一组整数,两个数字的返回索引,它们的和会等于一个特定…
准备刷一刷LeetCode了. 题目: ''' Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Becaus…
循环分值:10 来源: 北邮天枢战队 难度:易 参与人数:1478人 Get Flag:467人 答题人数:523人 解题通过率:89% 给出一个循环公式,对于一个整数n,当n为奇数时,n=3n+1,当n为偶数时,n=n/2,如此循环下去直到n=1时停止. 现要求对两个整数i = 900.j = 1000,输出i.j之间(包括i.j)的所有数进行上述循环时的最大循环次数(包括n和1). 格式:CTF{xxx} 解题链接: 原题链接:http://www.shiyanbar.com/ctf/192…
SB!SB!SB!分值:20 来源: 西普学院 难度:中 参与人数:4913人 Get Flag:1541人 答题人数:1577人 解题通过率:98% LSB 解题链接: http://ctf5.shiyanbar.com/stega/ste.png 原题链接:http://www.shiyanbar.com/ctf/45 [解题报告] 这是我入门隐写术开始写的第一道题,题目标题为SB!SB!SB!,这题目有点意思,我们点击链接来看一下题干,咦,是一张愤怒的小鸟反派里面的猪,咱们把这个图片下载下…
丘比龙的最爱分值:10 来源: 2014HCTF 难度:易 参与人数:4498人 Get Flag:1366人 答题人数:1384人 解题通过率:99% 传说,丘比龙是丘比特的弟弟,丘比龙是一只小爱神,虽然有两只翅膀,但因为吃多了,导致身体太胖,所以飞不起来~那么问题来了?!丘比龙吃什么食物吃多了变胖了 解题链接: 原题链接:http://www.shiyanbar.com/ctf/722 [解题报告] 这是我入门安全杂项开始写的第一道题,这道题很有意思,也没有给你任何链接,没有任何提示,就只给…
这里没有key分值:10 来源: 西普学院 难度:易 参与人数:5577人 Get Flag:1965人 答题人数:2074人 解题通过率:95% 你说没有就没有啊,俺为啥要听你的啊 解题链接: http://ctf5.shiyanbar.com:8080/4/index.html 原题链接:http://www.shiyanbar.com/ctf/7 [解题报告] 这是我入门密码学开始写的第一道题,题目标题为这里没有key,真的没有key嘛,没有key干嘛要你写呢?于是点开解题链接,弹出一个对…
what a fuck!这是什么鬼东西?分值:10 来源: DUTCTF 难度:易 参与人数:7942人 Get Flag:3358人 答题人数:3475人 解题通过率:97% what a fuck!这是什么鬼东西? 解题链接:http://ctf5.shiyanbar.com/DUTCTF/1.html 原题链接:http://www.shiyanbar.com/ctf/56 [解题报告]: 这是我入门Web开始写的第一道题,what a fuck!第一眼看到这名字,特别惊讶,到底是什么东东…
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any point in time. Example: Input: [   [1,3,1], [1,5…