https://blog.csdn.net/CV2017/article/details/82659742 或运算符,左右两边通常为关系或相等表达式,第一个操作数将完全运算,仅当第一个操作数的计算结果为 false 时计算第二个操作数,当第一个操作数的计算结果为 true 时,不用计算第二个操作数和这之后的操作数,直接运行后面的代码了 classSolution {public:boo...
题意:寻找两个有序数组的中位数 我的思路:寻找第k大的数,http://blog.csdn.net/yutianzuijin/article/details/11499917/ 我的代码: View Code 6、ZigZag Conversion 题意:将一字符串竖着写成n行的之字形,再按行读出 我的思路:模拟,找到规律即可,按行号i=0~numRows-1循环,每个循环每次前进两步,第一步st...
2 本文链接:https://blog.csdn.net/liujiaqi12345/article/details/88357041 3 Leetcode JAVA 题解: https:///mJackie/leetcode 4 自己日常刷题经过是这样的: 5 6 拿到题目,看一眼Difficulty,然后自己思考一下解题思路。如果解不出来,就记下在哪里卡住了,难点在哪。 7 如果对应的题目有Solution,就看...
代码运行次数:0 运行 AI代码解释 classSolution:defexpressiveWords(self,s:str,words:List[str])->int:count=0n=len(s)forwordinwords:ifself.check(word,s):count+=1returncount defcheck(self,word,s):n=len(s)m=len(word)ifm>n:returnFalse ...
#1237. Find Positive Integer Solution for a Given Equation (E) 1000 #1415. The k-th Lexicographical String of All Happy Strings of Length n (M+) 1600 #1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts (M-) 1200 #1498. Number of Subsequences That Satisfy ...
class Solution { public: int trap(vector<int>& height) { if(height.empty()) return 0; height.push_back(0); int res =0; stack<int> st;//decreasing stack for(int i = 0; i<height.size();++i){ while(!st.empty() && height[i] > height[st.top()]){ ...
public class Solution { public String slidingWindow(String s, String t) { // 起始的时候,都位于 0,同方向移动 int left = 0; int right = 0; while (right < sLen) { if ( 在右移的过程中检测是否满足条件 ) { // 对状态做修改,好让程序在后面检测到满足条件 } // 右边界右移 1 格 right...
publicclassSolution{publicStringminWindow(Strings,Stringt) {// 起始的时候,都位于 0,同方向移动intleft=0;intright=0;while(right<sLen) {if(在右移的过程中检测是否满足条件) {// 对状态做修改,好让程序在后面检测到满足条件}// 右边界右移 1 格right++;while(满足条件) {// 走到这里是满足条件的,...
//采用备忘录的方式来存子问题的解以避免大量的重复计算 class Solution { int[] memo; ...
class Solution { public int climbStairs(int n) { return calcWays(n); } priv...