随笔分类 - Affirm
摘要:Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1 o
阅读全文
摘要:Infix expression: The expression of the form a op b. When an operator is in-between every pair of operands.Postfix expression: The expression of the f
阅读全文
摘要:Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1 o
阅读全文
摘要:Postfix to Prefix Conversion Postfix: An expression is called the postfix expression if the operator appears in the expression after the operands. Sim
阅读全文
摘要:You are given a string with lower case letters only. Compress it by putting the count of the letter after it. If the letter appears once, Example: com
阅读全文
摘要:Given many words, words[i] has weight i. Design a class WordFilter that supports one function, WordFilter.f(String prefix, String suffix). It will ret
阅读全文
摘要:Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made ...
阅读全文
摘要:Given a list of strings, output the most frequent characters that are in the same group as the letter. For example, for string "abc", a, b,c are in th
阅读全文
摘要:Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the s
阅读全文
摘要:You are given a string expression representing a Lisp-like expression to return the integer value of. The syntax for these expressions is given as fol
阅读全文
摘要:Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: getand put. get(key) - Get th
阅读全文
摘要:Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's
阅读全文
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo
阅读全文
摘要:Determine whether an integer is a palindrome. Do this without extra space. 分析:把一个数倒过来,然后看两个数是否相同。 Reverse digits of an integer. Example1: x = 123, ret
阅读全文
摘要:Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:
阅读全文
摘要:Design a data structure that supports all following operations in O(1) time. insert(val): Inserts an item val to the set if not already present.remove
阅读全文
摘要:Nested List Weight Sum I Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either a
阅读全文
摘要:Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list
阅读全文
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va
阅读全文
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ
阅读全文

浙公网安备 33010602011771号