[LeetCode] Decode Ways
Decode WaysA message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1 'B' -> 2 ... 'Z' -...
[LeetCode] Maximum Gap
Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 eleme...
[LeetCode] Candy
Candy There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must hav...
[LeetCode] Longest Common Prefix
Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings.解题思路:注意string类的append和push_back方法的使用。1. 先求两个字符串的前缀,在求此前缀与剩下的字符串的前缀。代码如下:class&nbs...
[LeetCode] Divide Two Integers
Divide Two IntegersDivide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.解题思路:考虑到可能会溢出,因此可用long long类型强制转化int类型。另外,这种类型题目一般都是先确定符号位,将所有的值转化成正数,然...
Restore IP Addresses
Restore IP AddressesGiven a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255....
[LeetCode] Sort Colors
Sort ColorsGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will ...
[LeetCode] Fraction to Recurring Decimal
Fraction to Recurring DecimalGiven two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeatin...
樱花树下的家-吉他谱
樱花树下的家——武汉大学校园歌曲词曲:彭挺半个月亮珞珈那面爬上来又是一年三月樱花开一别将是三年还五载明年花开你还来不来我真想这一辈子坐在樱花树下弹着我的破吉他雪白的花瓣贴着脸颊飘落下美丽樱园我的家蓝蓝的天空有朵朝北飞的云彩燕子从南方悄悄把春天捎来绿色的春风吹开了今年的故事你不经意离开摘朵花儿头上戴暖暖的阳光唤你梦中醒来窗外的花才刚刚开多年的日子早已凝结心上象露珠儿花瓣上徘徊熟悉的歌儿在这寂寞的日子...
思君黯然
日日念君不见君,相思一轮复一轮。又见秋叶霜满地,漫心愁肠再惹尘。
好办法牢记前缀++(--)与后缀++(--)执行顺序
前缀++(--)和后缀++(--)引无数程序员竞折腰。虽然实际项目中由于程序员的自我修养,不会对++或--写出让人晦涩难懂的代码,但是在面试笔试的时候,一些“无聊的”企业总会拿这个来刁难我们。例如对于下面一个题目:int a = 4; //分别执行以下五种情况(1) a += a++; //a=?(2) a += ++a; //a=?(3) ++a += a; //a=?(4) ++a += a+...
c#枚举类型遍历、类型转换
EnumType是用户定义的枚举类型。遍历:foreach (var enumType in Enum.GetValues(typeof(EnumType))) { string name = enumType.ToString(); &n...
C# 实现eval,支持任意个数、任意基本类型的参数
js中有一个方法eval,能够随时执行用户编写的代码。例如:js中的代码:eval("alert('hello world');");将会弹出一个写有hello world的提示框。但C#中却没有对应的方法。Google了一下,网站http://www.ckode.dk/programming/eval-in-c-yes-its-possible/基本...
c#爬取Silverlight网页
前言: 爬取普通的文本网页非常容易,但爬取Silverlight的网页代码时,有时候可能会加密。这样就会很麻烦了。下面就爬取网站http://zx.bjmemc.com.cn/ (北京空气质量网)进行说明。任务:网站http://zx.bjmemc.com.cn/显示的内容如下图所示。我们的任务就是将空气质量数据抓取下来。工具:1、fiddler,http://www.telerik.com/fi...
必应地图显示点击事件经纬度
必应地图的官方sdk说明文档网址:https://www.bingmapsportal.com/ISDK/AjaxV7#CreateMap1,请仔细研读。 但是翻遍官方说明文档,并没有展示如何获得事件的经纬度。网上查询好久,均未找到。摸索许久,终于获知。在此粘出,方便他人,亦供自己日后查阅。
SqlServer导出数据文件
1、对数据库右键-》Tasks-》Generate Scripts2、点击Next3、选择是导出整个数据库开始单个数据表4、设置成保存为文件,并设置存储位置,然后点击高级按钮5、根据选择是导出模式、模式加数据、还是仅数据,点击ok6、会有让你review的一个窗口,点击next,再点击finish7、以下是我只导出数据的文件结果
C# 循环中的匿名方法
有这么一段C#代码:Func func = () => { return 0; }; for (int i = 0; i
c++读取文件操作之peek、>>和get
预备知识:fstream提供了三个类,用来实现c++对文件的操作。(文件的创建、读、写)。ifstream -- 从已有的文件读 ofstream -- 向文件写内容 fstream -- 打开文件供读写 文件打开模式: ios::in 读ios::out 写ios::app 从文件末尾开始写ios::binary 二进制模式ios::nocreate 打开...
Asp.net .net(C#) 获取当前命名空间,类名,方法名的方法
public static string GetMethodInfo() { string str = ""; //取得当前方法命名空间 str ...
他忍住了多少次想联系你的冲动
这篇文章写到我心坎去了……华丽丽的分割线有一天凌晨跟没睡的几个好友在群里聊天,不知怎么的就聊到了ex的话题。群里平时一直话很多属于活跃气氛的男生突然不说话了,等我们快聊完这个话题的时候,他来了一句:“我昨天晚上还梦到她了,她穿的还是我送给她的蓝色裙子,她对我说她想要再抱抱我,然后我就醒了,没想到这么久了我还是会做这样的梦。”“那你们分手多久了?”“三年。”后来有一天机缘巧合我跟他一起去北京,他对我...