- 博客(6)
- 资源 (4)
- 收藏
- 关注
原创 C++指向类成员函数的以及虚函数的函数指针
先熟悉一下最简单的函数指针吧。 1. 函数指针可以在声明的时候赋值#include <iostream>using namespace std;int MyFunc(int i){ return i+1;}int (*p1)(int i)=MyFunc; //函数指针的声明int main(){ cout << "MyFunc: " <<(*p1)(2)<< end
2017-07-31 16:46:32 646
原创 链表实现两个字符串的加法(反转链表)
前不久面试时,被要求手写一下,用链表实现两个字符串的加法。 好久没写链表了,当时一紧张还写错了。于是来复习一下。 思路很简单,先把两个字符串转成链表,然后再对链表进行反转, 就可以从最低位开始加了,类似于大数加法的思路。#include <iostream>#include <cstdio>using namespace std;struct ListNode { int va
2017-07-19 14:17:25 469
原创 [leetcode]500.Keyboard Row Add to List
Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below.
2017-07-18 00:49:49 236
原创 LeetCode 561. Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possibl
2017-07-14 00:34:53 190
原创 617. Merge Two Binary Trees
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge them into a new binary tree.
2017-07-14 00:27:04 167
原创 带括号的四则运算C语言实现
最近在尝试着写一个简单的C语言编译器,于是先写了一个四则运算表达式来练练手。#include<stdio.h>#include<ctype.h>#include<string.h>#include<stdlib.h>#include<math.h>/***********************************************************************
2017-07-10 13:21:34 8722 3
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人