Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). 给定一颗二叉树,判断该二叉树是否是对称的。 For example, this binary tree is symmetric: 如下面的二叉树是对称的。 1/ \2 2/ \3
Given an input string, reverse the string word by word. For example, Given s = “the sky is blue”, return “blue is sky the”. class Solution(object):def reverseWords(self, s):""":type s: str:rtyp
LeetCode151- 翻转字符串里的单词(Reverse Words in a String) 最近全国疫情严重,待在家里没事干,马上又要准备春招了,最近刷刷题,记录一下!再说一句,武汉加油,大家出门记得戴口罩! 1、题目 给定一个字符串,逐个翻转字符串中的每个单词。 示例 1: 输入: "the sky is blue"输出: "blue is sky the" 示例 2:
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". Update (2015-02-12): For C programmers: Try to solve it in-place in O