Leetcode Lect1 String相关题目】的更多相关文章

Java 的 String 类基本用法介绍:http://www.runoob.com/java/java-string.html Java 的 String.substring 函数:https://beginnersbook.com/2013/12/java-string-substring-method-example/ Google coding style:https://google.github.io/styleguide/javaguide.html String 不支持下标索引…
暂时接触到LeetCode上与链表反转相关的题目一共有3道,在这篇博文里面总结一下.首先要讲一下我一开始思考的误区:链表的反转,不是改变节点的位置,而是改变每一个节点next指针的指向. 下面直接看看LeetCode上的题目: 206. Reverse Linked List 这是一道最基本的链表反转题目. /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * Lis…
  leetcode-19-Remove Nth From End of List—移除链表中倒数第n个元素 leetcode-21-Merge Two Sorted Lists—两个已排序链表归并 leetcode-23-Merge k Sorted Lists—k个已排序链表归并 leetcode-24-Swap Nodes in Pairs—链表中元素两两一组交换 leetcode-25-Reverse Nodes in K-Group—链表中元素k个一组逆序 leetcode-61-Ro…
LeetCode 跟树结构相关的题目的测试用例中大多是通过String数组来构造树.例如{2,#,3,#,4,#,5,#,6},可以构造出如下的树(将树结构逆时针选择90度显示): 6            5        4    32 很直观地可以理解,输入的String数组是对树结构进行“层序”遍历得到的结果.以下代码用于构造树结构,并提供printTree用于打印树结构. package util; import java.util.LinkedList; import java.ut…
LeetCode: Palindrome 回文相关题目汇总 LeetCode: Palindrome Partitioning 解题报告 LeetCode: Palindrome Partitioning II 解题报告 Leetcode:[DP]Longest Palindromic Substring 解题报告 LeetCode: Valid Palindrome 解题报告…
leetcode tree相关题目小结 所使用的方法不外乎递归,DFS,BFS. 1. 题100 Same Tree Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same value Ex…
终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 如果各位看官们,大神们发现了任何错误,或是代码无法通过OJ,或是有更好的解法,或是有任何疑问,意见和建议的话,请一定要在对应的帖子下面评论区留言告知博主啊(如果不方便注册博客园的话,可以下载下文提到的APP,在Feedback中给博主发邮件交流哈),同时也请大家踊跃地,大量地,盲目地提供各个题目的follow up一起讨论哈,多谢多谢,祝大家刷得愉快…
Given a non-empty string, encode the string such that its encoded length is the shortest. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note: k will be a positive integ…
Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer. You may assume th…
Given a non-empty string str and an integer k, rearrange the string such that the same characters are at least distance k from each other. All input strings are given in lowercase letters. If it is not possible to rearrange the string, return an empt…