自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ajiangfan的博客

希望能拥有一个思维捕捉器

原创 Python实现生成西瓜数据集的Excel文件

为了获得《机器学习》(周志华)中的完整西瓜数据集,这里通过Python使用xlwt模块自动生成数据集的Excel文件。 实现代码如下: import xlwt def createDataSet(): dataSet = [ # 1 ['1�...

2020-02-24 13:11:27 193 0

翻译 如何识破“AI万金油”

本文的目的是让大家了解当前AI在各个领域的应用及发展情况,以此来识别网上那些打着AI的旗号进行各种不靠谱的评测和预测行为,即“AI万金油”骗术,防止大家被收智商税。 一、为什么如今存在大量的”AI万金油“骗术? AI是一系列相关技术的涵盖性术语,其中有些技术已经取得杰出瞩目的进步,例如战胜人类顶尖...

2019-11-21 16:57:35 37 0

原创 Direct2D实现文字的描边和填充

一、实现思路 通过继承IDWriteTextRenderer定义自己的文本渲染类并重写DrawGlyphRun方法,最终将该类实例作为 IDWriteTextLayout::Draw的参数传入进行文本的绘制。 二、代码实现 1、自定义文本渲染类 class CustomTextRenderer :...

2019-01-19 16:28:47 577 0

原创 Direct2D实现文字镜像阴影

一、实现思路 先绘制文字阴影部分,绘制阴影文本后应用3DTransform与高斯模糊特效,最后再正常绘制一次文本主体。 二、实现代码 hr = m_pDWriteFactory->CreateTextFormat( sc_fontName, ...

2019-01-19 14:04:16 383 0

原创 jack在64位win10下引起程序崩溃问题的解决方法

0、问题背景 自己的程序调用libjack64.dll启动时就发生异常崩溃,自己的开发环境是64位win10,在64位win7下测试可以正常运行。针对这个问题尝试了一些解决方案后,最终确定是使用的libjack64.dll和自己的应用程序库不兼容所导致的。 1、尝试使用weak_libjack...

2018-08-04 11:21:18 409 0

原创 Tif文件与JPG文件之间的合并拆分实现(使用LibTIFF与OpenCV)

以下是使用LibTiff与OpenCV在win32控制台程序中实现tif文件与jpg文件之间的转换。 将一个tif文件拆分为一或多张jpg图片: #include <afxwin.h> #include <afx.h> #include ...

2018-03-23 17:15:28 1838 2

原创 Longest Common Prefix(最长相同前缀)

Write a function to find the longest common prefix string amongst an array of strings.(找出字符串数组中的最长相同前缀字符串)1.个人分析 思路一:采用BF法。首先取第一个字符串作为比较字符串,然后将该字符串的...

2017-01-06 14:58:13 1208 0

原创 3Sum(三数和)

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of...

2017-01-06 14:51:46 287 0

原创 Container With Most Water(最大容器)

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 endpoi...

2016-12-22 10:33:03 491 0

原创 Palindrome Number(回文数字)

Determine whether an integer is a palindrome. Do this without extra space.(判断一个整型数是否是回文,要求不能借用额外的空间)1.个人分析 题目中的额外空间应该是指空间复杂度为O(1),所有的负数不属于回文数。2.个人解法...

2016-12-18 20:49:42 666 0

原创 Reverse Integer(反转整型数)

Reverse digits of an integer.(反转一个整型数)Example1: x = 123, return 321 Example2: x = -123, return -3211.个人分析 思路一:整型数转字符串->反转字符串->字符串转整型 思路二:数学解...

2016-12-12 16:58:18 1306 0

原创 ZigZag Conversion(“Z”形转换)

The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (字符串”PAYPALISHIRING”以给定的行数写成如下Z形模式) (you may want ...

2016-12-12 16:53:25 1621 0

原创 Longest Substring Without Repeating Characters(无重复最长子串)

Given a string, find the length of the longest substring without repeating characters.(给定一字符串,找出无重复的最长子串的长度)Examples: Given “abcabcbb”, the answer i...

2016-12-05 15:30:26 452 0

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

2016-12-03 14:26:15 555 0

原创 Two Sum(两数之和)

Given an array of integers, return indices of the two numbers such that they add up to a specific target.(给定一个整型数组,返回两数和的索引,这两数的和必须得到指定的目标)You may as...

2016-12-02 18:12:49 275 0

原创 Binary Tree Paths(二叉树的路径)

Given a binary tree, return all root-to-leaf paths.(给定一棵二叉树,返回所有根节点到叶子节点的路径)For example, given the following binary tree: 1 / \ 2 3 \ 5Al...

2016-12-01 13:00:52 328 0

原创 Counting Bits(统计比特位)

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and ...

2016-11-30 10:54:52 607 0

原创 Balanced Binary Tree(平衡二叉树)

Given a binary tree, determine if it is height-balanced.(给定一棵二叉树,判断该树的高度是否平衡)For this problem, a height-balanced binary tree is defined as a binary t...

2016-11-29 18:51:27 527 0

原创 Number of Boomerangs(统计"boomerang"的数目)

Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equal...

2016-11-28 14:50:48 336 0

原创 House Robber(窃贼的计划)

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping y...

2016-11-10 21:08:11 331 0

原创 Symmetric Tree(对称树)

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).(给定一棵二叉树,判断其是否对称)For example, this binary tree [1,2,2,3...

2016-11-09 16:44:44 242 0

原创 Binary Tree Level Order Traversal II(层次遍历二叉树II)

Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).(给定一...

2016-11-08 11:10:43 326 0

原创 Battleships in a Board(统计战舰数)

Given an 2D board, count how many different battleships are in it. The battleships are represented with ‘X’s, empty slots are represented with ‘.’s. ...

2016-11-07 16:39:39 199 0

原创 Arranging Coins(硬币排列)

You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.(给你n枚硬币来组成一个阶梯形,这个阶梯每第k行必须包含k枚...

2016-11-03 21:36:00 1598 0

原创 Merge Two Sorted Lists(合并两个有序链表)

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.(合并两个有序链...

2016-10-20 12:09:28 413 0

原创 Lowest Common Ancestor of a Binary Search Tree(二叉树最小公共祖先)

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.(给定一个二分查找树,找到给定两节点的最小公共祖先)According to the defi...

2016-10-17 12:10:06 232 0

原创 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, ...

2016-10-15 13:16:45 411 0

原创 Climbing Stairs(爬楼梯)

You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you ...

2016-10-15 13:13:40 486 0

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

2016-10-15 13:10:05 407 0

原创 Number of 1 Bits(二进制中1的个数)

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).(给定一个无符号整型数,实现一个函数返回该整数的...

2016-10-12 11:25:00 400 0

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

2016-10-12 11:17:58 500 0

原创 Happy Number

Write an algorithm to determine if a number is “happy”.(判断一个数字是否是”happy”)A happy number is a number defined by the following process: Starting with a...

2016-10-12 11:12:44 136 0

原创 Power of Four

Given an integer (signed 32 bits), write a function to check whether it is a power of 4.(给定一个32位整型数,判断其是否是4的幂)1.个人分析 判断一个整型数是否是4的幂,必定是从2的幂中寻找符合条件的。1...

2016-10-07 12:35:15 269 0

原创 Power of Two

Given an integer, write a function to determine if it is a power of two.(给定一个整数,判断其是否是2的幂)1.个人分析 与判断是否是3的幂类似,普通解法就是不断地对输入的整数进行整除2,如果是2的幂则结果一定为1。2.个人...

2016-10-07 12:31:20 238 0

原创 Power of Three

Given an integer, write a function to determine if it is a power of three.(给定一个整数,判断其是否是3的幂)Follow up: Could you do it without using any loop / recu...

2016-10-07 12:26:27 254 0

原创 Intersection of Two Arrays(两数组的交叉元素)

Given two arrays, write a function to compute their intersection.(给定两个数组,计算它们的交叉元素)Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].N...

2016-09-26 11:40:06 471 0

原创 Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.(给定一个非负整数num,重复加上它的所有数字直到结果只有一位数。)For example: G...

2016-09-25 12:27:44 281 0

原创 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 t...

2016-09-25 11:25:36 388 0

原创 Invert Binary Tree(反转二叉树)

Invert a binary tree.(反转一棵二叉树) 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 11.个人分析: 这道题其实在《剑指Off...

2016-09-25 11:19:49 306 0

原创 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.(给定一个数组,将数组中值为0的...

2016-09-24 11:49:56 413 0

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