文章 2021-12-15 来自:开发者社区

LeetCode之Reverse String

1、题目:Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".2、代码实现:代码实现1: public static String reverseString(String s) { if...

文章 2021-12-15 来自:开发者社区

LeetCode之Reverse Integer

1、题目Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Note:The input is assumed to be a 32-bit signed integer. Your function should retur....

文章 2019-08-05 来自:开发者社区

LeetCode 150:逆波兰表达式求值 Evaluate Reverse Polish Notation

题目: 根据逆波兰表示法,求表达式的值。 有效的运算符包括 +, -, *, / 。每个运算对象可以是整数,也可以是另一个逆波兰表达式。 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an ....

文章 2019-07-22 来自:开发者社区

LeetCode 206:反转链表 Reverse Linked List

反转一个单链表。 Reverse a singly linked list. 示例: 输入: 1->2->3->4->5->NULL 输出: 5->4->3->2->1->NULL 进阶:你可以迭代或递归地反转链表。你能否用两种方法解决这道题? Follow up: A linked list can be reversed eithe....

文章 2019-07-11 来自:开发者社区

LeetCode 151:给定一个字符串,逐个翻转字符串中的每个单词 Reverse Words in a String

公众号:爱写bug(ID:icodebugs) 翻转字符串里的单词 Given an input string, reverse the string word by word. 示例 1: 输入: "the sky is blue" 输出: "blue is sky the" 示例 2: 输入: " hello world! " 输出: "world! hello" 解释: 输入字符串可以...

文章 2019-06-30 来自:开发者社区

Leetcode 344:Reverse String 反转字符串(python、java)

Leetcode 344:Reverse String 反转字符串 公众号:爱写bugWrite a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, you must....

文章 2017-12-14 来自:开发者社区

[LeetCode] Reverse String 翻转字符串

Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". 这道题没什么难度,直接从两头往中间走,同时交换两边的字符即可,参见代码如下: 解法一: class Solution { public: str...

文章 2017-12-09 来自:开发者社区

[LeetCode] Reverse String II 翻转字符串之二

Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of the....

文章 2017-12-09 来自:开发者社区

[LeetCode] Reverse Pairs 翻转对

Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j]. You need to return the number of important reverse pairs i...

文章 2017-12-04 来自:开发者社区

[LeetCode] Reverse Integer 翻转整数

Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here are some good questions to ask before cod...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

算法编程

开发者社区在线编程频道官方技术圈。包含算法资源更新,周赛动态,每日一题互动。

+关注