码迷,mamicode.com
首页 >  
搜索关键字:valid anagram    ( 3019个结果
leetcode Valid Parentheses
代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 bool isValid(string s) { 8 map smap; 9 smap.insert(make_pair('(', ')'));10...
分类:其他好文   时间:2015-04-15 11:19:22    阅读次数:159
Lintcode: Two Strings Are Anagrams
Write a method anagram(s,t) to decide if two strings are anagrams or not.ExampleGiven s="abcd", t="dcab", return trueO(N)time, O(1) space 1 public cla...
分类:其他好文   时间:2015-04-15 07:12:54    阅读次数:104
LeetCode --- 98. Validate Binary Search Tree
题目链接:Validate Binary Search Tree Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with ...
分类:其他好文   时间:2015-04-14 21:41:20    阅读次数:118
Valid Sudoku
/*给一个不完整的数独,'.'代表为空判断数独是否合法*/public class Solution { public boolean check1(char[][] board){ for(int i = 0 ; i < 9 ; i ++){ int[] ...
分类:其他好文   时间:2015-04-14 16:13:00    阅读次数:108
[LeetCode] Longest Valid Parentheses 最长有效括号
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:其他好文   时间:2015-04-14 14:35:10    阅读次数:121
[LeetCode] Valid Parentheses 验证括号
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:其他好文   时间:2015-04-14 14:15:23    阅读次数:108
Valid Pattern Lock
Valid Pattern LockTime Limit:2 Seconds Memory Limit:65536 KBPattern lock security is generally used in Android handsets instead of a password. The pat...
分类:其他好文   时间:2015-04-13 22:51:31    阅读次数:144
浙江大学2015年校赛B题 ZOJ 3861 Valid Pattern Lock
这道题目是队友写的,貌似是用暴力枚举出来。题意:给出一组数,要求这组数在解锁的界面可能的滑动序列。思路:按照是否能够直接到达建图,如1可以直接到2,但是1不能直接到3,因为中间必须经过一个2。要注意的假如2已结访问过,那么1就可以直接到2。建图DFS,图要更新。Source Code:#includ...
分类:其他好文   时间:2015-04-13 22:22:32    阅读次数:140
ZOJ3861 Valid Pattern Lock
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3861题意:给出一组数,要求这组数在解锁的界面可能的滑动序列。思路:按照是否能够直接到达建图,如1可以直接到2,但是1不能直接到3,因为中间必须经过一个2。要注意的假...
分类:其他好文   时间:2015-04-13 20:45:24    阅读次数:126
[LeetCode] Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:其他好文   时间:2015-04-13 18:23:52    阅读次数:105
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!