- 博客(50)
- 资源 (12)
- 问答 (4)
- 收藏
- 关注
原创 412. Fizz Buzz
/*Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.
2017-08-29 06:34:52 520
原创 389.Find the Difference
/* Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was
2017-08-29 06:34:03 461
原创 387.First Unique Character in a String
/*387. First Unique Character in a StringGiven a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s
2017-08-29 06:33:33 562
原创 383. Ransom Note
/*Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines
2017-08-29 06:32:24 516
原创 367. Valid Perfect Square
/*Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16Returns
2017-08-29 06:31:16 427
原创 35. Search Insert Position
/* 35. Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assu
2017-08-29 06:30:24 424
原创 345.Reverse Vowels of a String
/*Write a function that takes a string as input and reverse only the vowels of a string.*/char* reverseVowels(char* s) { int x,i=0,j=strlen(s) - 1;//将左右两侧的编号记下,右边为i,左边为j char temp; for
2017-08-29 06:29:34 414
原创 344.Reverse String
/*Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Subscribe to see which companies asked this question.*///解法一,C语言实现,耗时
2017-08-29 06:28:46 350
原创 342.Power of Four
/*Given an integer (signed 32 bits), write a function to check whether it is a power of 4. */bool isPowerOfFour(int num){ int i; double test=(double)(num); for(i=0;i<100;i++) {
2017-08-29 06:28:02 395
原创 326.Power of Three
/*Given an integer, write a function to determine if it is a power of three. */bool isPowerOfThree(int n) { return(n>0 && 1162261467%n==0);}
2017-08-29 06:27:19 403
原创 my.ini 文件 解决mysql无法存储中文字符问题
这个my.ini文件是在mysql文件目录下直接找到的,本来想改my.ini文件中的内容。结果在网络上到处找都没有找到,如果你找到my_default.ini,修改完毕之后可以将其直接改名为my.ini,然后放在mysql文件一级目录下直接使用。具体位置:showvariableslike'character_set_%'http://www.oschina.n
2017-08-27 05:24:34 1763
原创 RC522模块
最近参加了一个比赛,用到树莓派+RC522模块,下面演示由读卡器向屏幕显示数据。程序中用到了bcm2835的库,所以需要安装这个库:[root@alarmpi ~]# pcaman -Q libbcm2835【该库的介绍可以见:http://www.airspayce.com/mikem/bcm2835/】#include#include "RFID.h"
2017-08-27 04:53:22 3921
原创 哈夫曼树
哈夫曼树的目的是构造带权路径最小的树,权值大的节点在上方,权值小的节点在下方。例如在传讯编码中,用到了A,B,C,D,四种编码,每个编码使用的频率不一样,分别是0.1, 0.3, 0.4, 0.2。那么可以解释为表示C的编码越短,总编码长度就越短。例如在8各节点中,各自的权重是1,23,50,87,63,10,17,33.构造哈夫曼树的步骤是:1.从节点集F中选取两个节点值最小
2017-08-27 04:52:00 642
原创 线索二叉树
线索化二叉树相对于之前的树的遍历,在树的定义上增加了两个值,一个是ltag,另外一个是rtag。ltag代表着这个节点的是否有右孩子,如果有,则ltag=1,p->lchild指向的是p的左孩子。如果没有左孩子,那么ltag=0,p->lchild指向的是p的前驱节点。rtag代表着这个节点的是否有右孩子,如果有,则rtag=1,p->rchild指向的是p的右孩子。如果没有左
2017-08-27 04:15:39 1710 3
原创 292. Nim Game
/*You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be
2017-08-26 18:47:50 401
原创 283.Move Zeroes
/* DescriptionHintsSubmissionsSolutionsGiven an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given num
2017-08-26 18:47:06 357
原创 27.Remove Element
/*Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.T
2017-08-26 18:45:54 327
原创 26.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 wit
2017-08-26 18:44:57 300
原创 268. Missing Number
/* 268. Missing NumberGiven an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:You
2017-08-26 18:44:14 323
原创 264.Ugly Number II
/* Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the fir
2017-08-26 18:43:26 695
原创 263.Ugly Number
/* Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly sinc
2017-08-26 18:42:43 368
原创 258.Add Digits
/* Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one
2017-08-26 18:41:47 322
原创 242. Valid Anagram
/*242. Valid AnagramGiven 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.No
2017-08-26 18:40:51 357
原创 237.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 th
2017-08-26 18:39:55 404
原创 树的遍历(先中后序,非递归,层次遍历)
树的遍历分为先序遍历,中序遍历以及后续遍历。其中分为递归形式与非递归形式,及层次遍历。先序遍历:首先访问根节点,然后访问左子树,最后访问右子树。void PreOrder(BiTree T){ if(p) { visit(p); PreOrder(p->lchild); PreOrder(p->rch
2017-08-23 22:19:40 872
原创 234.Palindrome Linked List
/*Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?*///解法一 51% 9ms//思路:判断回文,首先把链表中的数放到数组中,然后进行比对即可/** * Definitio
2017-08-22 08:51:12 462
原创 231.Power of Two
/*Given an integer, write a function to determine if it is a power of two. */bool isPowerOfTwo(int n) { return(n>0 && 1073741824%n==0);}
2017-08-22 08:49:42 339
原创 206。Reverse Linked List
/*Reverse a singly linked list.*///解法一 21% 3ms/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; *///思路:先创建iintnt 一个数
2017-08-22 08:48:41 334
原创 203。Remove Linked List Elements
/*Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5 *//** * Defin
2017-08-22 08:47:31 297
原创 202. Happy Number
/*Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the s
2017-08-22 08:44:48 406
原创 2. Add Two Numbers
/*You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retu
2017-08-22 08:41:50 1095
原创 196. Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.+----+------------------+| Id | Email |+----+---
2017-08-22 08:40:29 434
原创 191。Number of1 Bits
/*Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 0000
2017-08-22 08:39:29 338
原创 190。Reverse Bits
/* Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00
2017-08-22 08:38:18 339
原创 171. Excel Sheet Column Number
/*Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3
2017-08-22 08:37:38 399
原创 169.Majority Element
/*题目要求:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority
2017-08-21 15:59:29 316
原创 167.Two Sum II_Input array is sorted
/* DescriptionHintsSubmissionsSolutionsGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function
2017-08-21 15:58:34 361
原创 141.linked list cycle
/*判断输入的链表是否是循环链表思路:利用快慢指针,一个是p = p->next;另外一个是q = q->next;如果两个指针相遇了,则说明是循环链表*///解法一 22% 6ms/** * Definition for singly-linked list. * struct ListNode { * int val; * struct
2017-08-21 15:57:36 352
原创 14. Longest Common Prefix.cpp
/*Write a function to find the longest common prefix string amongst an array of strings.*/class Solution {public: string longestCommonPrefix(vector& strs) { string commo_str;
2017-08-21 15:56:18 369
原创 136.Single Number
/*题目要求:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it withou
2017-08-21 15:55:39 416
bert-base-uncased
2024-08-19
EVA-GCN-main.zip
2021-07-01
biwi下载地址.txt
2020-05-05
300w-lp下载地址.txt
2020-05-05
python中文分词使用的中文文章
2019-03-10
Notepad++ tidy2 代码自动排序dll文件
2016-02-25
关于从数据库取出C代码并运行的问题
2016-05-11
jar里的函数如何调用?
2015-12-29
wamp图标是黄色,求解
2015-11-12
php echo无法显示输出
2015-11-09
TA创建的收藏夹 TA关注的收藏夹
TA关注的人