自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Jason's BLOG

记录、收集、积累、总结、进步

  • 博客(160)
  • 收藏
  • 关注

翻译 几款Golang IDE对比

Go语言目前已经在开发者中越发的流行,自然很多人都在寻找合适的IDE来实现代码语法高亮、自动补全以及其他编辑特性。下面就几种常用的IDE进行对比介绍:1. Sublime text这个文本编辑器在开发者中较为普及,应该说sublime并非一个完全成熟的IDE,但是它具备很多语言的扩展插件,比如python、lua等,其中有一个插件GoSublime专门针对go语言,GoSubl

2017-06-27 23:44:52 142014 8

翻译 Go会否给Java带来冲击?

根据最新的数据统计,Java和JavaScript主导了开发者的忠诚度。然而,随着更多的应用程序转移到云上,这种情况可能会发生变化。当苹果公司和Facebook争相着去推出新的编程语言,以吸引开发者的想象力和创造力时,已经被证明可靠、屡试不爽的java语言作为开发者的首选语言,占据着至高无上的地位,有趣的是,虽然对Java的一般兴趣(以及c#php之类的同行)似乎在一段时间内都在减弱,

2017-06-27 13:21:53 26777 7

转载 IPv4 header checksum算法

The IPv4 header checksum is a simple checksum used in version 4 of the Internet Protocol (IPv4) to protect the header of IPv4 data packets against data corruption. This checksum is calculated only

2017-01-12 11:28:10 4692

原创 [Leetcode]Two Sum II - Input array is sorted

Given 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 twoSum should return indices of the two number

2016-12-27 14:52:39 494

原创 [Leetcode] Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan

2016-11-28 14:28:37 400

原创 [Leetcode] Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2016-11-28 11:29:52 401

原创 [Leetcode] Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.题意:查找字符串数组中的最长子串思路:1. 找到最短长度的字符串,然后求得其他字符串与最小串的最大公共长度char* longestCommonPrefix(char**strs, int strsSize) {

2016-11-23 19:10:57 332

原创 [Leetcode] Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]and the difference between i and j is at most k.题

2016-11-23 16:16:55 307

原创 [Leetcode] 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 the end, the

2016-11-23 13:18:26 247

原创 [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

2016-11-22 13:03:47 264

原创 判断单链表是否有环

1、对于单链表而言,只有通过从头到尾的遍历方式,如果发现尾指针指向头指针则说明有环。2、使用双指针,一个遍历的速度快,一个较慢,如果快的指针追上了慢的那个说明有环:/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next;

2016-11-21 17:22:52 337

原创 [Leetcode] 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.

2016-11-21 16:41:36 259

原创 [Leetcode] Number of 1 Bits & Counting 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 000000

2016-11-19 15:27:46 351

原创 [Leetcode] Remove Duplicates from Sorted List

Given 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, return 1->2->3.思路:1. 前提是整个链表是有序的2.

2016-11-19 14:58:09 279

原创 [Leetcode] Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2016-11-18 10:20:09 311

原创 [Leetcode] Power of Three

Given an integer, write a function to determine if it is a power of three.判断一个数是否为3的幂:一,除数法,最容易想到的方法:1. 首先是能够整除2. 整除到最后的数一定为1则说明TRUE否则FALSEbool isPowerOfThree(int n) { if (n <= 0)

2016-11-17 19:25:22 335

原创 [Leetcode]Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element

2016-11-17 18:53:16 281

原创 [Leetcode]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.从题目看来,得到要求:1. 长度

2016-11-17 13:31:32 367

原创 [Leetcode]Reverse Linked List-再写单链表反转

Leetcode碰巧又出现这个问题,看来面试算法这个是很常见的题型,不过很久没写过,这次写来又花了不少时间,主要耽搁在思想的选择上:一是想通过遍历时直接将指针反转,这样比较高效,但是需要处理好前后指针及后续的关系;二是通过构建一个新的链表头,然后遍历时直接将链表元素加入到新链接中,该算法比较简明;/** * Definition for singly-linked list.

2016-11-17 10:12:00 2015

原创 [Leetcode] Move Zeroes

Given 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 nums = [0, 1, 0, 3, 12], after calling your fu

2016-11-16 16:42:49 280

原创 [Leetcode] Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1最先想到的当然是递归的思想,将两个左右指针进行互换:/** * Definition for a binary tree node.

2016-11-11 11:00:19 218

原创 [Leetcode]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

2016-11-10 16:21:52 271

原创 [Leetcode]Single Number

Given an array of integers, every element appears twice except for one. Find that single one.思路:1. 使用HASH表存储每个数组元素出现的次数2. 理解按位异或操作的本质原理int singleNumber(int* nums, int numsSize) { int

2016-11-10 14:06:24 212

原创 [Leetcode]Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.解:考虑深度优先访问方式求深度./** * Def

2016-11-10 13:59:50 225

原创 Jquery UI 获取选中的tab Index

在页面加载中需要对tab进行初始化,同时要注册了active属性的处理函数: $( function() { $( "#tabs" ).tabs({ activate: function( event, ui ){ refresh_ifr_page(); } }); } );function getSelectedTabIndex(){ va

2016-11-09 09:06:45 4158

原创 Leetcode-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 the

2016-09-30 00:10:57 242

原创 专业理解-20160922

大学学的专业,到现在才有点深刻的理解,大四那会的选修课,现在看来基本都成为研究生阶段的课题和方向,本科学习阶段也就是为这些来做准备的吧,工作了这么几年,一直觉得工作方向特别重要,阴差阳错的选择了嵌入式通信行业,作了软件研发,也就是所谓的程序员,刚开始干的特有劲,后面接着是各种挑战,工作能力不足及工作能力与事情本身的不匹配,有时候事情太简单、单一觉得没劲,因为这会离职或者有些迷茫,现在想来是职业规划不

2016-09-23 00:06:33 338

原创 谈坚持和总结-20160912

20160912想过要将自己这几个的工作及学习知识好好总结一下,觉得很有必要,这两年是工作历程中的最重要的几年,周末一直会是懒散的状态,学习效率比较低下,XMIND知道很久,却没怎么用,内核方面一直在看,却没有系统性的深入学习,总是看了又看的重复,书到用时方恨少,真理啊!之前想用微博,但发现推送的垃圾信息太多,头脑风暴,时间都花在筛选上了,我需要专注,工作中学习,学习中提高,积累中总结,做个行动派!

2016-09-12 09:15:20 380

原创 PyQT实现一个自动生成配置工具

设备要量产,需要为每台设备烧录MAC及设备标识信息,今天为这事情专门写个小工具实现 这个功能,主要解决批量生成烧录配置信息,这里对其过程作个总结:1. 选择QT的原因在于当时手上的图形工具就这一种,不想再花时间去搭建新的环境2. QT简洁高效,搭配Python比较方便3. 功能比较清晰,逻辑简单主要过程:1. 使用QT DESIGNER设置好界面,最终生成一个.

2016-09-06 19:47:53 1074

原创 实现单链表的反转

单链表的反转实现很常见:#include #include #include #define NUM 9typedef struct LNode{ int data; struct LNode *next;}LNode, *LinkedList;LNode slinklist = {0, NULL};int initLinkl

2016-08-30 14:04:45 689

原创 function to count the number of "1" of one byte

function to count the number of "1" of one byte ,for example 5(0101)has two "1"经常遇到的面试题,毫无疑问需要借助位操作:unsigned int bitCount (unsigned int value) { unsigned int count = 0; while (value >

2016-08-30 14:02:14 295

原创 求一个数组中子数组中的和的最大值

遇到的面试题:int maxSumOfArray(int array[], int len){ int mark = 0, i , j; int result = array[0]; for(i = 0; i < len; i ++) { if (mark >= 0) { mark += array[i]; } else { mark = arra

2016-08-30 13:59:09 537

原创 实现memove

void *memmoves(void *dest, const void *src, size_t count){ char *tmp_dst = NULL; const char *tmp_src = NULL; if (dest <= src) { tmp_dst = dest; tmp_src = src;

2016-08-30 13:54:13 362

原创 [Leetcode]字符串的反转

Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".很简单,针对长度为奇偶情况不同,作对应的处理:char* reverseString(char* rs) { char *p

2016-08-28 14:33:15 788

原创 [Leetcode]Longest Substring Without Repeating Characters

题为:求最大长度的子串,要求不能有重复字符首先想到的是暴力解决方法,循环创建每个子串,并记录长度,同时确认是否有重复字符,如下:int lengthOfLongestSubstring(char* s) { int maxLen = 0; int i = 0, j = 0, len = 0; char *p = s, *res = s; len = strlen(s);

2016-08-28 11:31:21 525

原创 [LeetCode]Add Two Numbers解析

将两个链表的值进行相加,并返回一个新的链表,注意两个地方:一是考虑两个链表的长度是否相同,二是考虑相加后的进位问题/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* a

2016-08-19 14:12:05 664

原创 git+gerrit clone 脚本

使用gerrit作为code Review平台后,克隆代码的简易方法,写了个脚本,工作中常用到:#!/usr/bin/env python# coding=utf-8 # for git clone helper# author: jason # date: 20160624import os, sysGERRIT_SERVER="192.168.1.187"GERRIT_

2016-07-20 11:51:29 2224

原创 Gerrit+(nginx/Apache) 的git CodeReview平台

git、gitweb、gerrit安装包、apache服务器 测试采用的OS是CentOS 6.7 X64系统Git版本 1.7.1Gerrit版本为:gerrit-2.10.6.warWeb服务器为标准的apache http版本 除了gerrit外,其他都可以直接通过yum 直接安装。Gerrit需要进入官网:https://www.ge

2016-07-20 11:40:13 1976

原创 gdbus移植至mips

glib版本:glib-2.36.0、libffi-3.2.1、libiconv.so.2.5.1  、gettext-0.18.1 、zlib-1.2.8~/work/mips-linux/apps/public/CROSS=mips-linux-uclibc-APP_PUBLIC_DIR=~/work/mips-linux/apps/public/FILESYSTEM=~/work/m

2016-07-19 19:49:48 991

原创 base64编解码方法

base64编码: int base64_encrypt(unsigned char *buf, const unsigned char*text, int size) { static char *base64_encoding = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

2015-09-12 22:04:23 832

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除