排序:
默认
按更新时间
按访问量

(c++)——内联函数

首先,内联函数通常是较小的函数,但是为什么要提出使用它呢? 我们的代码通常需要一些共同的操作,但是,当需要进行对此修改呢,这时就需要没一个修改, 可以想到将此操作定义成函数,但是新的问题又出现了,函数的话必须进行函数调用,调用的 过程是保存以前的寄存器状态,并在调用结束后复原。可样可能进行操作的时...

2016-07-02 14:24:04

阅读数:131

评论数:0

Binary Tree Right Side View

问题 Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. F...

2015-11-20 16:33:12

阅读数:217

评论数:0

Binary Tree Maximum Path Sum

问题 Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node...

2015-11-20 16:31:17

阅读数:178

评论数:0

Kth Smallest Element in a BST

问题 Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ ...

2015-11-20 16:29:45

阅读数:200

评论数:0

Path Sum

问题 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given s...

2015-11-20 16:27:51

阅读数:186

评论数:0

Populating Next Right Pointers in Each Node II

问题 Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previ...

2015-11-20 16:26:21

阅读数:172

评论数:0

Populating Next Right Pointers in Each Node

问题 Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate ea...

2015-11-20 16:05:32

阅读数:168

评论数: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 is symmetric: ...

2015-11-20 16:03:29

阅读数:170

评论数:0

Unique Binary Search Trees II

问题 Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should re...

2015-11-20 15:56:42

阅读数:163

评论数:0

Validate Binary Search Tree

问题 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node cont...

2015-11-20 15:55:02

阅读数:160

评论数:0

Path Sum II

问题 Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree...

2015-11-20 15:52:06

阅读数:193

评论数:0

Lowest Common Ancestor of a Binary Tree

问题 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “T...

2015-11-20 15:49:40

阅读数:172

评论数:0

Binary Tree Maximum Path Sum

问题 Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node...

2015-11-20 15:47:46

阅读数:201

评论数:0

Perfect Squares

1.问题描述 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, ...

2015-11-20 15:45:46

阅读数:156

评论数:0

Sort List

1.问题描述 Sort a linked list in O(n log n) time using constant space complexity. 链表排序。 2.解答 /** * Definition for singly-linked list. * struct List...

2015-11-20 15:42:47

阅读数:171

评论数:0

Factorial Trailing Zeroes

1.问题描述 Given an integer n, return the number of trailing zeroes in n!. 阶乘的连续后缀零个数。 2.解答 int trailingZeroes(int n) { int sum=0; whil...

2015-11-20 15:40:32

阅读数:169

评论数:0

Palindrome Partitioning

1.问题描述 Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s...

2015-11-20 15:37:35

阅读数:168

评论数:0

C语言笔试面试总结(网上搜集)

1.关键字static的作用是什么? 有三个明显的作用: 1)在函数体内,一个被声明为静态的变量在这个函数被调用过程中维持其值不变 2)在模块内(但在函数体外),静态的变量可以被模块内所有函数访问,但不能被模块外其他函数访问 3)在模块内,一个被声明为静态的函数只能被这一模块内的其他函数调...

2015-11-19 15:55:42

阅读数:1754

评论数:0

预编译命令

预编译:在真正编译之前设置一些变量,环境设置。 主要的命令有 #define——宏定义:文本替换,不能提供变量类型检查,还有需要主要宏定义函数时, 结合顺序有时候发生变化。#if #elif #else #endif 可以实现代码的分块执行。实现分块调试。#include #include #...

2015-11-09 11:04:16

阅读数:207

评论数:0

C标准库(1)

提供宏assert的定义。还需要引用宏NDEBUG。 如果定了DNEBUG则不执行assert语句。 void assert(int expression); 如果断言错误,执行abort函数。

2015-11-08 14:01:58

阅读数:182

评论数:0

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