摘要:
解题思路:每次去掉目标字符串的末尾一个字符,这边要设置一个方向变量,这样就可以用双指针法来代替翻转字符串的操作,时间复杂度O(target.length())。 阅读全文
摘要:
存储器不仅能存放数据,而且也能存放指令,在形式上,两者没有区别,但计算机应能区分数据还是指令 控制器应能自动取出指令来执行 运算器应能进行加减乘除四种基本运算,并且也能进行一些逻辑运算和附加运算 操作人员可以通过输入设备、输出设备和主机进行通信 阅读全文
摘要:
Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put. get(key) - Get t 阅读全文
摘要:
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators a 阅读全文
摘要:
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
摘要:
Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. Example: ["RandomizedCollec 阅读全文
摘要:
Design a data structure that supports all following operations in average O(1) time. Example: 阅读全文
摘要:
Shuffle a set of numbers without duplicates. Example: 阅读全文
摘要:
Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 阅读全文
摘要:
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by upd 阅读全文