楼主: Oceanid77
跳转到指定楼层
上一主题 下一主题
收起左侧

刷题记录帖

🔗
 楼主| Oceanid77 2019-10-8 14:10:14 | 只看该作者
全局:
438. Find All Anagrams in a String
check sliding winfdow.
how to deal with anagrams?
76. Minimum Window Substring
study tomorrow
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-9 13:58:19 | 只看该作者
全局:
76. Minimum Window Substring
done
438. Find All Anagrams in a String
done. prc tmr
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-10 11:50:27 | 只看该作者
全局:
76. Minimum Window Substring
char[] ch=t.toCharArray();
time complexity for this one.
code 时间优化:
instead i use t.charAt(index), it is much faster.
check time complexity and solution.
567. Permutation in String
debug, why
209. Minimum Size Subarray Sum
finish two pointer. I did brute force before.
code 优化、
Approach #3 Using Binary search [Accepted]
325. Maximum Size Subarray Sum Equals k
560. Subarray Sum Equals K
brute force done study more tmor
239. Sliding Window Maximum
continue with sliding window
463. Island Perimeter
still not finish
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-11 09:43:13 | 只看该作者
全局:
567. Permutation in String
How will you check whether one string is a permutation of another string?
One way is to sort the string and then compare
done.
debug 心得: 有时候表达的和自己想的不是一样的。 有耐心, 确认一下自己写的和想的是不是一样的?
边际条件的case

study more approach
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-13 02:22:36 | 只看该作者
全局:
周五 study 155
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-13 11:16:02 | 只看该作者
全局:
休息一天,不做了
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-14 14:28:55 | 只看该作者
全局:
155. Min Stack
716. Max Stack
design

Sliding window , summary
https://leetcode.com/problems/mi ... -substring-problems
340. Longest Substring with At Most K Distinct Characters
159. Longest Substring with At Most Two Distinct Characters
done




回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-15 13:21:52 | 只看该作者
全局:
146. LRU Cache
not finish yet.
LinkedHashMap.
Approach 2: Hashmap + DoubleLinkedList
Youtube , how list can achieve that?
844. Backspace String Compare
== -> is a reference comparison, i.e. both objects point to the same memory location
.equals() -> evaluates to the comparison of values in the objects
finish stack method. zong jie ziji kaishi de silu.
continue with two pointer method

682. Baseball Game
done
transform string to Integer.

232. Implement Queue using Stacks
need study more
739. Daily Temperatures
good
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-16 13:09:22 | 只看该作者
全局:
本帖最后由 Oceanid77 于 2019-10-16 13:10 编辑

739. Daily Temperatures
Arrays.fill(next, Integer.MAX_VALUE);
This method assigns the specified data type value to each element of the specified range of the specified array.

Syntax:
// Makes all elements of a[] equal to "val"
public static void fill(int[] a, int val)

// Makes elements from from_Index (inclusive) to to_Index
// (exclusive) equal to "val"
public static void fill(int[] a, int from_Index, int to_Index, int val)

This method doesn't return any value.
Approach #1: Next Array [Accepted]
Approach #2: Stack [Accepted]

496. Next Greater Element I
find the bug of following code:
class Solution {
    public int[] nextGreaterElement(int[] nums1, int[] nums2) {
        Stack<Integer> stack = new Stack<>();
        HashMap<Integer, Integer> map = new HashMap<>();
        for(int i= nums2.length()-1; i>=0;i--){
            while(!stack.isEmpty() && nums2>stack.peek() ){
                stack.pop();
            }
            int find=stack.isEmpty? -1:stack.peek();
            map.push(nums2[i],find);
            stack.push(nums2[i]);
        }
        for(int k=0; k<nums1.length(); k++){
            int temp = nums1[k];
            nums1[k]=map.get(temp);
        }
        return nums1;
    }
}

503. Next Greater Element II
array.length : length is a final variable applicable for arrays. With the help of length variable, we can obtain the size of the array.
string.length() : length() method is a final variable which is applicable for string objects. length() method returns the number of characters presents in the string.

735. Asteroid Collision
good idea~simulation
605. Can Place Flowers
think about it
[/i][/i]
回复

使用道具 举报

🔗
 楼主| Oceanid77 2019-10-17 12:49:10 | 只看该作者
全局:
605. Can Place Flowers
play chess

394. Decode String
StringBuilder ans = new StringBuilder();

Character.isDigit(string.charAt(index)) (JavaDoc) will return true if it's a digit
Character.isLetter(string.charAt(index)) (JavaDoc) will return true if it's a letter

Java char to int Example: Get ASCII value
Java char to int Example: Character.getNumericValue()
java using Character.getNumericValue(char) method which returns an integer value.
Java char to int Example: String.valueOf()
returns integer value of specified char value using String.valueOf(char) method.
150. Evaluate Reverse Polish Notation
study it
没有脑子想了,休息
周末也能高效率!!周末早点起床
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表