
LeetCode
Web魔法师
Web魔法师
展开
-
c语言实现:在母字符串中查找子字符串出现的次数
//功能:用c语言实现在母字符串中查找子字符串出现的次数//分析:从母字符串中的第一个字符开始寻找与子字符串第一个字符相同的子串//然后从第二个字符开始,直到母字符串结束//测试用例: 母字符串aaaaaaaaaaaa// 子字符串aaaint Num0fstr(char *Mstr, char *substr){ int number = 0; ...原创 2018-03-02 14:14:46 · 12592 阅读 · 3 评论 -
Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.原创 2015-08-15 19:43:19 · 592 阅读 · 0 评论 -
Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value原创 2015-08-09 20:34:07 · 434 阅读 · 0 评论 -
Remove Nth Node From End of List
题目:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from t原创 2015-06-15 20:08:56 · 450 阅读 · 0 评论 -
[LeetCode] Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with原创 2015-06-15 20:02:01 · 413 阅读 · 0 评论 -
Remove Duplicates from Sorted List
emove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3,原创 2015-05-21 09:10:12 · 384 阅读 · 0 评论 -
Symmetric Tree
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 4 4 3But the f原创 2015-05-18 20:44:52 · 450 阅读 · 0 评论 -
Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.Code:(C 语言原创 2015-05-18 16:14:47 · 410 阅读 · 0 评论