c++
文章平均质量分 87
shiter
CSDN博客专家,人工智能与大数据领域优秀创作者,累计近500W人次访问。 熟悉自然语言处理(NLP)、大数据(Spark 、Elasticsearch)、数据分析(Scala,Python),计算机视觉(OpenCV、立体匹配)等领域的研发工作。世界500强,高级算法工程师, 曾参与并负责国家级大数据项目,负责大健康平台相关开发与管理工作,负责金融行业AI与大数据平台产品设计、开发与落地。编程不仅仅是技术,还是艺术!talk is cheap,show me the code!
展开
-
QT 实现 Toolbar 的全局颜色选择框 与按钮自定义演示选择
文章大纲实现效果实现过程调整 工具栏设置工具栏按钮设置勾选框样式默认勾选设置信号函数其他调试参考参考文献实现效果初学QT 发现果真是强大的不行,原来我都是用MFC 虽然有异曲同工之妙 ,但是感觉跨平台的QT更加精髓一些,下面,我们来实现一个全局的自定义颜色选择工具栏,效果如下,主要由一组互斥的 CheckBox 和 一个单独的自定义 Qpushbutton 构成。实现过程调整 工具栏我们首先在主窗口布局的工具栏中 ,给工具栏增加我们自己写的,自定义选择框函数,并且由分隔符 隔开void原创 2021-02-05 00:05:01 · 2062 阅读 · 0 评论 -
leetcode 102 Binary Tree Level Order Traversal
// TreeToVector.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include "stdio.h"using namespace std; struct TreeNode { int val; TreeNode *left;原创 2015-07-14 22:53:54 · 2884 阅读 · 0 评论 -
leetcode 217 Contains Duplicate 数组中是否有重复的数字
Contains Duplicate Total Accepted: 26477 Total Submissions: 73478 My SubmissionsGiven an array of integers, find if the array contains any duplicates. Your function should retu原创 2015-08-09 21:48:10 · 3534 阅读 · 0 评论 -
最近在线笔试的一些感想和总结,阿里巴巴,腾讯,百度,360。c++研发,机器学习等岗位
最近听说,在线笔试也可以大家一起做,怪不得,我做不过去呢。// jingdongtest.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;int getHigh(int x){ int result = x; while(x>0)原创 2015-09-19 00:29:20 · 4914 阅读 · 3 评论 -
阿里电话面试问题----100万个URL如何找到出现频率最高的前100个?
这个题是阿里的一个电话面试题,我想的头一个解决方案,有点限制,后面再写优化的实验数据,python从百度抓得:# -*- coding: utf-8 -*-"""Spyder EditorThis is a temporary script file."""import urllib2 import re import os#connect to a URL原创 2015-07-25 01:04:06 · 6840 阅读 · 5 评论 -
京东2015在线笔试----编程题--分苹果
其实挺坑爹的一个题目:也不知道考察的重点是啥,大体思路是从2个人分开始算起,自己找到规律了,写代码实现。实现代码一:#include #include size_t apple(size_t b){ return b>0?pow(b,b)-(b-1):0;}int main(){ printf("%d\n",apple(8原创 2015-10-22 10:48:15 · 3847 阅读 · 2 评论 -
360,京东,在线编程题
讨论帖子:http://bbs.csdn.net/topics/391830032题目:1.2.原创 2015-09-25 23:37:02 · 1732 阅读 · 0 评论 -
windows下实现win32俄罗斯方块练手,编程的几点心得
编程珠玑2阅读笔记:1.使用c语言性能监视器,完成对代码的调优工作2.关联数组: 拓扑排序算法,可以用于当存在遮挡的时候决定三维场景的绘制顺序。3.小型算法中的测试与调试工具脚手架程序:《人月神话》一个软件产品中应该有一半的代码都是脚手架。类似,小型的代码库4.自描述数据每个程序员都知道破解神秘数据的挫折与艰辛。5.劈原创 2016-03-05 22:23:17 · 5555 阅读 · 3 评论 -
微软在线测试之lucky string,有关斐波那契的题目都在此了
解决方案:int _tmain(int argc,_TCHAR* argv[]){ size_t fib[] = {1,2,3,5,8,13,21,34}; string str,tempstr; cin >> str; tempstr = str; auto it = unique(tempstr.begin(),tempstr.end());原创 2016-03-06 11:04:35 · 2753 阅读 · 0 评论 -
赵老师的留下来
VC调试(TC或BC用TD调试)时按Alt+8、Alt+6和Alt+5,打开汇编窗口、内存窗口和寄存器窗口看每句C对应的汇编、单步执行并观察相应内存和寄存器变化,这样过一遍不就啥都明白了吗。(Linux或Unix下可以在用GDB调试时,看每句C对应的汇编并单步执行观察相应内存和寄存器变化。)想要从本质上理解C指针,必须学习汇编以及C和汇编的对应关系。从汇编的角度理解和学习C语言的指针,原本...翻译 2020-01-27 18:04:38 · 3197 阅读 · 3 评论 -
leetcode 101 Symmetric Tree
Symmetric Tree Total Accepted: 61440 Total Submissions: 194643 My Submissions Given a binary tree, check whether it is a mirror of itself (ie, symmetric ar翻译 2015-07-09 22:45:15 · 1738 阅读 · 0 评论 -
leetcode 205 Isomorphic Strings
Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another chara原创 2015-04-30 14:26:17 · 2680 阅读 · 2 评论 -
leetcode 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 squares o原创 2015-04-29 17:06:19 · 3607 阅读 · 0 评论 -
leetcode 155 Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. • push(x) – Push element x onto stack. • pop() – Removes the element on top of the stack. • top()原创 2015-05-11 23:56:31 · 1976 阅读 · 0 评论 -
leetcode 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 00111001011110原创 2015-05-04 15:46:12 · 1586 阅读 · 0 评论 -
推荐一个优秀的c++源代码,TinyXml2
项目主页:http://grinninglizard.com/tinyxml2docs/index.html tinyxml2.h /*Original code by Lee Thomason (www.grinninglizard.com)This software is provided 'as-is', without any express or implie原创 2015-05-26 21:31:50 · 4904 阅读 · 0 评论 -
leetcode 26 Remove Duplicates from Sorted Array
Remove Duplicates from Sorted ArrayTotal Accepted: 66627 Total Submissions: 212739 My Submissions Given a sorted array, remove the duplicates in place such that原创 2015-06-25 15:52:53 · 2530 阅读 · 0 评论 -
leetcode 8 String to Integer (atoi)
String to Integer (atoi)Total Accepted:52232 Total Submissions:401038 My Submissions Question Solution Implement atoi to convert a string to an integer.Hint: Carefully conside原创 2015-06-24 00:03:23 · 2184 阅读 · 0 评论 -
leetcode 88 Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 intonums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal tom + n) to hold addit原创 2015-06-24 22:47:51 · 3777 阅读 · 0 评论 -
leetcode 3 Longest Substring Without Repeating Characters最长无重复子串
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo原创 2016-04-05 22:27:27 · 5360 阅读 · 0 评论 -
leetcode 2 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link原创 2016-02-27 17:35:57 · 2072 阅读 · 2 评论 -
OpenCV问题集锦,图片显示不出来,WaitKey(0),imread()不能读图片,未经处理的异常,等问题集合
昨天根据uc伯克利的人工图像分割文件原创 2014-08-31 11:03:09 · 33257 阅读 · 10 评论 -
基于GraphCuts图割算法的图像分割----OpenCV代码与实现
转载请注明出处:http://blog.csdn.net/wangyaninglm/article/details/44151213,来自:shiter编写程序的艺术 1.绪论图切割算法是组合图论的经典算法之一。近年来,许多学者将其应用到图像和视频分割中,取得了很好的效果。本文简单介绍了图切算法和交互式图像分割技术,以及图切算法在交互式图像分割中的应用。 图像分割指图像分...翻译 2015-03-09 10:11:17 · 62231 阅读 · 42 评论 -
OpenCV 矩形轮廓检测
#include "cv.h"#include #include #include #include #include #include #pragma comment(lib,"opencv_core2410d.lib") #pragma comment(lib,"opencv_highgui2410d.lib") #pragma comment(lib,"op翻译 2014-12-11 11:01:03 · 44187 阅读 · 4 评论 -
leetcode 10 Regular Expression Matching(简单正则表达式匹配)
最近代码写的少了,而leetcode一直想做一个python,c/c++解题报告的专题,c/c++一直是我非常喜欢的,c语言编程练习的重要性体现在linux内核编程以及一些大公司算法上机的要求,python主要为了后序转型数据分析和机器学习,所以今天来做一个难度为hard 的简单正则表达式匹配。做了很多leetcode题目,我们来总结一下套路: 首先一般是检查输入参数是否正确,然后是处理算法的特殊原创 2017-02-21 01:19:33 · 7673 阅读 · 1 评论 -
leetcode 11 Container with Most Water
1.题目描述Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0).Find原创 2017-04-16 21:02:28 · 1318 阅读 · 0 评论 -
leetcode 新题型----SQL,shell,system design
leetcode 主要是一个针对北美的coder人群找工作的代码练习网站,我在2015年初次接触这个网站的时候,总共只有200多道题目,是一个类似acm 的a题网站。这些年变化越来越大,主要是因为找工作当然是多样化的考核过程,leetcode 也逐渐与时俱进,推出了下面几个类别的联系,今天我们随便挑几个练习一下:175. Combine Two Tables —SQLTable: Person原创 2017-08-20 23:52:37 · 1617 阅读 · 0 评论 -
leetcode Sum 系列----寻找和为定值的多个数
july 大神有个程序员编程艺术系列,第五章《寻找和为定值的多个数》,现在我们站在大牛的肩膀上,对leetcode上n个数求和的系列问题做个阶段性总结。1.leetcode No.1 2sumGiven an array of integers, return indices of the two numbers such that they add up to a specifi...原创 2018-02-17 01:10:19 · 8188 阅读 · 0 评论 -
leetcode 37. Sudoku Solver 36. Valid Sudoku 数独问题
三星机试也考了类似的题目,只不过是要针对给出的数独修改其中三个错误数字,总过10个测试用例只过了3个与世界500强无缘了36. Valid SudokuDetermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled...原创 2016-05-04 22:07:52 · 2120 阅读 · 0 评论 -
【编程练习】复习一下树的遍历
#include #include #include #include using namespace std;typedef struct BiTNode {//二叉树结点 char data; //数据 struct BiTNode *lchild,*rchild; //左右孩子指针} BiTNode,*BiTree;in翻译 2015-08-06 16:56:45 · 1774 阅读 · 0 评论 -
【编程练习】八大排序算法
概述 排序有内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存。 我们这里说说八大排序就是内部排序。 当n较大,则应采用时间复杂度为O(nlog2n)的排序方法:快速排序、堆排序或归并排序序。 快速排序:是目前基于比较的内部排序中被认为是最好的方法,当待排序的关键字是随机分布时,快速排转载 2015-04-01 13:33:01 · 4412 阅读 · 0 评论 -
OpenCV实时美颜摄像并生成H264视频流
为什么美颜摄像这么简单的功能,OpenCV这个开源项目网上很少有代码呢?对于在windows平台下,生成h264视频流也比价麻烦,没有现成的api可以使用,需要借助MinGw编译libx264,或者ffmpeg才能使用。最近有个小需求,要推送直播视频流,我在网上查了一下有live555或者用librtmp来推送,但是前者还需要修改源代码,也挺麻烦的,现在先做到了下面几个步骤:1.OpenC原创 2016-03-04 23:36:59 · 22602 阅读 · 13 评论 -
【编程练习】3*3 的矩阵,值限定为1-9不重复,已知横竖的和,和一个斜着的值,求这个矩阵
x x x 11x x x 15x x x 1916 14 15 15讨论贴:http://bbs.csdn.net/topics/391816265先求横竖斜三行的精确匹配方法:// puzzl.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"/原创 2015-08-31 09:48:04 · 2836 阅读 · 2 评论 -
【编程练习】kmp算法代码
#include "StdAfx.h"#include using namespace std;void GetNextval(char* p, int* next){ int pLen = strlen(p); next[0] = -1; int k = -1; int j = 0; while (j < pLen - 1) { //p[k]表示前缀,p[j]表示后缀转载 2014-11-13 22:52:56 · 1401 阅读 · 0 评论 -
【编程练习】收集的一些c++代码片,算法排序,读文件,写日志,快速求积分等等
class LogFile{public: static LogFile &instance(); operator FILE *() const { return m_file; }private LogFile(const char *filename) { m_file = fopen(filename, "a+"); } ~LogFile() {原创 2014-11-06 20:45:28 · 2292 阅读 · 0 评论 -
【编程练习】快速select算法的实现
代码来自: http://blog.csdn.net/v_JULY_v转载 2014-11-22 21:51:55 · 1861 阅读 · 0 评论 -
【编程练习】正整数分解为几个连续自然数之和
题目:输入一个正整数,若该数能用几个连续正整数之和表示,则输出所有可能的正整数序列。 一个正整数有可能可以被表示为n(n>=2)个连续正整数之和,如: 15=1+2+3+4+5 15=4+5+6 15=7+8 有些数可以写成连续N(>1)个自然数之和,比如14=2+3+4+5;有些不能,比如8.那么如何判断一个数是否可以写成连续N个自然数之和呢? 一个数M若可以写成以a开头的翻译 2015-03-02 17:03:51 · 4373 阅读 · 0 评论 -
【编程练习】寻找和为定值的多个数
2010 年中兴面试题 编程求解: 输入两个整数n 和m,从数列1,2,3.......n 中随意取几个数, 使其和等于m ,要求将其中所有的可能组合列出来。 // 21 题递归方法 //copyright@ July && yansha //July、yansha,updated。 #include #include using namespace翻译 2015-03-02 17:03:54 · 1928 阅读 · 0 评论 -
【编程练习】求数组和最大的子数组
上代码先:问题代码来源:http://blog.csdn.net/v_JULY_v // MaxSum.cpp : 定义控制台应用程序的入口点。////copyright@ July//July、updated,2011.05.25。#include "stdafx.h"#include using namespace std;int maxsum(int转载 2015-03-05 12:23:39 · 1314 阅读 · 0 评论 -
leetcode 203 Remove Linked List Elements
Remove all elements from a linked list of integers that have valueval.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5 // Linklist.cp原创 2015-04-29 15:01:55 · 2333 阅读 · 2 评论