随笔分类 - 算法题刷题
摘要:题目描述 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。 题目分析 栈:后进先出(LIFO-last in first out) 队列:先进先出(FIFO-first in first out) 解题思路 假设两个栈为栈A和栈B 入栈时直接压入栈A 出栈时,如果
阅读全文
摘要:题目描述 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 案例数组: Approach 1:暴力解决法 所占时间,内存:215ms,18000k 思路:逐
阅读全文
摘要:题目描述 Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Example 2: Exampl
阅读全文
摘要:题目描述: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed
阅读全文
摘要:题目描述 Given a string, find the length of the longest substring without repeating characters. Example 1 Example 2 Input: "bbbbb" Output: 1 Explanation:
阅读全文
摘要:Description: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their
阅读全文
摘要:题目描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would h
阅读全文

浙公网安备 33010602011771号