题意:给定四个点,判断形状
思路:先求个凸包,就能把四个点排序,然后就是利用几何去判断,利用点积判垂直,利用叉积判平行
还有这题有个坑啊,明明说好是没有点共线的,其实是有的,所以求凸包如果不是4个点,直接输出不规则四边形即可
代码:
#include
#include
#include
#include
#include
using namespace std;
const int...
分类:
其他好文 时间:
2015-03-05 17:01:47
阅读次数:
157
Problem Description
A project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the workers needed in each month. When he hires or fires...
分类:
编程语言 时间:
2015-03-04 22:52:58
阅读次数:
250
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are
all va...
分类:
其他好文 时间:
2015-03-04 19:14:54
阅读次数:
121
题目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 sum.For example:Given the below binary tree and sum = ...
分类:
其他好文 时间:
2015-03-04 16:53:52
阅读次数:
108
Linked List Cycle问题:Given a linked list, determine if it has a cycle in it.思路:快指针,慢指针方法我的代码:public class Solution { public boolean hasCycle(ListNod...
分类:
其他好文 时间:
2015-03-04 15:59:11
阅读次数:
135
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine ...
分类:
编程语言 时间:
2015-03-03 09:58:55
阅读次数:
134
题目Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you a...
分类:
其他好文 时间:
2015-02-28 23:05:45
阅读次数:
276
https://oj.leetcode.com/problems/valid-sudoku/Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partia...
分类:
其他好文 时间:
2015-02-28 21:32:40
阅读次数:
223
Problem DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the ph...
分类:
其他好文 时间:
2015-02-27 21:25:48
阅读次数:
121
https://oj.leetcode.com/problems/validate-binary-search-tree/Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is ...
分类:
其他好文 时间:
2015-02-27 21:24:37
阅读次数:
143