随笔分类 -  Algorithms

上一页 1 2 3 4 5 6 ··· 9 下一页
摘要:Saying that we have some icons and a target sum, for example 16. How to choose which and how many icons to include to reach the target but minize the 阅读全文
posted @ 2021-01-19 03:00 Zhentiw 阅读(49) 评论(0) 推荐(0) 编辑
摘要:A serial of number, you cannot add siblings number together. To calcaulate what is the max sum value. Thinking: 1. Weather I should add current number 阅读全文
posted @ 2021-01-18 18:21 Zhentiw 阅读(123) 评论(0) 推荐(0) 编辑
摘要:Fibonacci sequence: The most well-known approach is memoization. Advantage is fast, but space complexity is big. O(N). Bottom-up: 1 : Bottom-up dynami 阅读全文
posted @ 2021-01-18 03:35 Zhentiw 阅读(127) 评论(0) 推荐(0) 编辑
摘要:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a domin 阅读全文
posted @ 2020-02-20 05:15 Zhentiw 阅读(203) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2020-02-12 02:39 Zhentiw 阅读(208) 评论(0) 推荐(0) 编辑
摘要:Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 /** * Definition for a binary tree node. * function 阅读全文
posted @ 2020-02-10 20:46 Zhentiw 阅读(107) 评论(0) 推荐(0) 编辑
摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] 阅读全文
posted @ 2020-02-07 04:24 Zhentiw 阅读(118) 评论(0) 推荐(0) 编辑
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num 阅读全文
posted @ 2020-01-30 04:10 Zhentiw 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true /** * Defi 阅读全文
posted @ 2020-01-23 04:34 Zhentiw 阅读(153) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-21 03:54 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-19 04:27 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-16 02:58 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-14 02:12 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-13 02:26 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-12 03:30 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-09 02:18 Zhentiw 阅读(0) 评论(0) 推荐(0) 编辑
摘要:A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2019-12-24 16:44 Zhentiw 阅读(178) 评论(0) 推荐(0) 编辑
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2019-12-22 18:04 Zhentiw 阅读(175) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-12-22 03:46 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the bi 阅读全文
posted @ 2019-12-21 02:45 Zhentiw 阅读(405) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 9 下一页
点击右上角即可分享
微信分享提示