Spurs

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2017年8月14日

摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say $(a_1, b_1), (a_2, b_2), ..., (a_n, b_n)$ which makes 阅读全文
posted @ 2017-08-14 23:00 英雄与侠义的化身 阅读(84) 评论(0) 推荐(0) 编辑

摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1 : Note : The input array will only contain and . The length o 阅读全文
posted @ 2017-08-14 20:35 英雄与侠义的化身 阅读(92) 评论(0) 推荐(0) 编辑

摘要: Given an array of integers where ($n =$ size of array), some elements appear twice and others appear once. Find all the elements of inclusive that do 阅读全文
posted @ 2017-08-14 18:15 英雄与侠义的化身 阅读(104) 评论(0) 推荐(0) 编辑

摘要: Given a non empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexi 阅读全文
posted @ 2017-08-14 16:51 英雄与侠义的化身 阅读(95) 评论(0) 推荐(0) 编辑

摘要: java GUI === Date: Feb. 15th, 2017 Author: xiang 依据毕向东老师的授课, 我组织了本文内容. Graphical User Interface Java的GUI部件在java.awt(抽象窗口工具包,需调用本地系统方法实现功能,重量级组件,不同系统窗口 阅读全文
posted @ 2017-08-14 12:51 英雄与侠义的化身 阅读(241) 评论(0) 推荐(0) 编辑

摘要: 这是半成品, 已完成了 部分, 形成了包含一棵完整树的 对象. 后续工作是需解析该 对象, 完成 工作. 阅读全文
posted @ 2017-08-14 12:46 英雄与侠义的化身 阅读(189) 评论(0) 推荐(0) 编辑

摘要: ```python # !/usr/bin/python # -*- coding:utf-8 -*- """ Re-implement kNN algorithm as a practice 使用该 kNN re-implement 的前提: train data 的标签必须转成0,1,2,...的形式 """ # Author: 相忠良(Zhong-Liang Xiang) #... 阅读全文
posted @ 2017-08-14 12:42 英雄与侠义的化身 阅读(142) 评论(0) 推荐(0) 编辑

摘要: 我仿照sk learn 中 GaussionNB 的结构, 重写了该算法的轮子,命名为 MyGaussionNB, 如下: 阅读全文
posted @ 2017-08-14 12:40 英雄与侠义的化身 阅读(173) 评论(0) 推荐(0) 编辑

摘要: Algorithm in Practice Author: Zhong Liang Xiang Date: Aug. 1st, 2017 不完整, 部分排序和查询算法, 需添加. Prerequisite 生成随机整数数组,打印数组, 元素交换. 1. Sorting 默认升序. 插入排序 直接插入 阅读全文
posted @ 2017-08-14 12:28 英雄与侠义的化身 阅读(196) 评论(0) 推荐(0) 编辑

摘要: ```c vector v(10, -1); //10个-1 v.size(); v.empty(); //is empty? ``` 阅读全文
posted @ 2017-08-14 12:21 英雄与侠义的化身 阅读(127) 评论(0) 推荐(0) 编辑

摘要: 2. struct A 和 typedef struct A 2.1 struct A 定义一个名为 的结构体. 下例定义了 同时,声明了两个变量(注意:不是类型别名) , . 2.2 typedef struct A 用来为 类型起 别名 (注意: 不是起变量名 ). 是类型名, 是指向 类型的指 阅读全文
posted @ 2017-08-14 12:20 英雄与侠义的化身 阅读(812) 评论(0) 推荐(0) 编辑

摘要: 1. 函数 数组 指针相关 1.1 定义并简单使用指针 c++ // 函数声明 void swap(int &x, int &y); int main() { // 局部变量声明 int a = 100; int b = 200; cout 阅读全文
posted @ 2017-08-14 12:19 英雄与侠义的化身 阅读(171) 评论(0) 推荐(0) 编辑

摘要: 0. 迷之 和 . 箭头( ):左边必须为指针; 点号(.):左边必须为实体。 e.g.1 class e.g.2 struct 阅读全文
posted @ 2017-08-14 12:18 英雄与侠义的化身 阅读(148) 评论(0) 推荐(0) 编辑

摘要: My Stuck in C++ Zhong Liang Xiang Oct. 1st, 2017 这个专题记录了对于我而言, c++迷一样的东西. 阅读全文
posted @ 2017-08-14 12:17 英雄与侠义的化身 阅读(89) 评论(0) 推荐(0) 编辑

摘要: 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] an 阅读全文
posted @ 2017-08-14 12:00 英雄与侠义的化身 阅读(81) 评论(0) 推荐(0) 编辑

摘要: 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 arr 阅读全文
posted @ 2017-08-14 11:58 英雄与侠义的化身 阅读(100) 评论(0) 推荐(0) 编辑

摘要: 189. Rotate Array Rotate an array of $n$ elements to the right by $k$ steps. For example, with $n = 7$ and $k = 3$, the array is rotated to . Related 阅读全文
posted @ 2017-08-14 11:57 英雄与侠义的化身 阅读(114) 评论(0) 推荐(0) 编辑

摘要: 169. Majority Element Given an array of size $n$, find the majority element. The majority element is the element that appears more than times. You may 阅读全文
posted @ 2017-08-14 11:56 英雄与侠义的化身 阅读(97) 评论(0) 推荐(0) 编辑

摘要: 122. Best Time to Buy and Sell Stock II 为获得最高收益而多次买卖,但只能像这样买卖: $O(n)$ time, $O(1)$ space. 自家代码: 阅读全文
posted @ 2017-08-14 11:55 英雄与侠义的化身 阅读(64) 评论(0) 推荐(0) 编辑

摘要: 167. 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 阅读全文
posted @ 2017-08-14 11:55 英雄与侠义的化身 阅读(87) 评论(0) 推荐(0) 编辑