随笔分类 - 算法题目
摘要:问题: 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 思路: 映入脑海的第一个想法是将数字转换为字符串,并检查字符串是否为回文。但是,这需要额外的非常量空间来创建问题描述中所不允许的字符串。 第二个想法是将数字本身反转,然后将反转后的数字与原始数字进行比较
阅读全文
摘要:原文: Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional
阅读全文
摘要:原文:Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? 译文:实现一个算法来判断一个字符串中的字
阅读全文
摘要:今天的题目是: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time compl
阅读全文
摘要:今天的题目是: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which
阅读全文
摘要:今天的题目是: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their node
阅读全文
摘要:1,第一道算法题,题目如下: 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 inpu
阅读全文