b******7 发帖数: 92 | 1 在[0,n-1]间查找,再减去多余的部分
int adjust(int A[],int n, int b)
{
if(n <= 0 || b < 0) return -1;
sort(A,A+n);
int index = -1;
int cursum = -1;
int low = 0, high = n-1;
while(low <= high)
{
int mid = low + (high - low)/2;
int sum = 0;
for(int i = 0; i < n; i++)
{
sum += min(A[i],A[mid]);
}
if(sum == b) return A[mid];
else if(sum > b)
{
index = mid;
cursum = sum;
high =... 阅读全帖 |
|
w******j 发帖数: 185 | 2 来个java的吧,带parent pointer和不带的,preorder和inorder的
import java.util.NoSuchElementException;
import java.util.Stack;
public class BST {
private Node root;
private static class Node {
int key;
Node left, right, parent;
Node(int key) {
this.key = key;
}
}
public BST(){
}
public BSTIterator inorderIterator() {
return new InorderIterator();
}
public BSTIterator preorderIterator() {
return new PreorderI... 阅读全帖 |
|
s**********e 发帖数: 326 | 3 来自主题: JobHunting版 - 一个小题目 贴个我的代码:
evenProb have 50/50 probability to return true, genAnyProb can return true
with any prob(first parameter)
main should call genAnyProb like this: genAnyProb(0.6,1,0.00001)
public boolean evenProb() {
return new Random().nextInt(2) == 0;
}
public boolean genAnyProb(double prob, double base, double epsilon) {
if (prob * base < epsilon) {
return true;
}
if (prob == 0.5) {
return evenProb();
} else if (prob > 0.5) {
... 阅读全帖 |
|
s*******s 发帖数: 1031 | 4 我的代码,用递归做。不一定对 。。
// n1n2n3n4
n1
/
n2
/ \
n3 n4
string getNextTag();
bool isTagStartingNode(string tag);
bool isTagEndNode(string tag);
bool isTagString(string tag)
struct TreeNode {
string value;
TreeNode *left;
TreeNode *right;
TreeNode(string v) : value(v), left(NULL), right(NULL) {}
};
TreeNode *parse(string startTag) {
// no more nodes left
if(str.size() == 0)
retu... 阅读全帖 |
|
x****8 发帖数: 127 | 5 stack?
public static void main(String[] args) {
XmlParser p = new XmlParser("ABDC");
String s;
Stack> stk = new Stack>();
TreeNode root = null;// = new TreeNode();
while((s = p.getNextTag()) != null){
if(p.isStartTag()){
String str = p.getNextTag();//assert is string tag
TreeNode node = new TreeNode(str);
... 阅读全帖 |
|
w******j 发帖数: 185 | 6 来个java的吧,带parent pointer和不带的,preorder和inorder的
import java.util.NoSuchElementException;
import java.util.Stack;
public class BST {
private Node root;
private static class Node {
int key;
Node left, right, parent;
Node(int key) {
this.key = key;
}
}
public BST(){
}
public BSTIterator inorderIterator() {
return new InorderIterator();
}
public BSTIterator preorderIterator() {
return new PreorderI... 阅读全帖 |
|
f**********t 发帖数: 1001 | 7 // Given an array [a1, a2, ..., an, b1, b2, ..., bn], transform it to [a1,
b1, a2, b2, ..., an, bn].
void EvenShuffle_(string &vi, size_t left, size_t right, bool leftmore) {
size_t len = right - left;
if (len < 2) {
return;
} else if (len == 2) {
if (!leftmore) {
swap(vi[left], vi[left + 1]);
}
return;
}
size_t mid = left + len / 2;
size_t ll = left + len / 4;
bool llmore = true;
bool rlmore = true;
if (len % 4 == 1) {
if (leftmore) {
++mid;
... 阅读全帖 |
|
r********7 发帖数: 102 | 8 之前面试 遇到过LRU 这道题,面试之前准备过,就直接说了 用hashmap 和
linkedlist。 但是实现起来发现很不好处理 删除命令。 由于是最后一题时间有限就
没在写下去。不过最后一再追问下,知道使用Doublelinkedlist。。。
不过感谢国人面试官,还是给过了。 再次鸣谢下。
然后看到leetcode有这道题(稍微有点不一样)就又做了下,还是问题重重,不得不感
叹自己实力的差距, 不过最后还是通过了,代码如下:
1.由于是菜鸟,代码很丑很啰嗦,希望大神们指点要怎么改进。
2.小弟有一事不明,为啥LRU 还要有(key,value)查询? 现实中,不就只有一个
value吗?然后HashMap 存。 现实中的LRU 每个内存有key
这个值吗?
希望帮忙讲解下LRU。
public class LRUCache {
public HashMap table = new
HashMap阅读全帖 |
|
y*****3 发帖数: 451 | 9 在网上看到一个,觉得有错误。感觉如果按照他这个做,如果要delete的碰巧是middle
child,而那个middle child又有孩子,结果就不对了。
public TrinaryNode delete(key, node) {
if (node == null) {
throw new RuntimeException();
} else if (key < node.key) {
node.left = delete(key, node.left);
} else if (key > node.key) {
node.right = delete(key, node.right);
} else {
if (node.middle != null) {
node.middle = delete(key, node.middle);
} else if (node.right != null) {
node.key = findMin(node.rig... 阅读全帖 |
|
l********o 发帖数: 56 | 10 来自主题: JobHunting版 - FB 面经 Rotate的那题我是这样做的,大牛们帮忙看一下吧
public static int findRotatePos(int[] arr) {
int i=0, j=arr.length-1;
while (i
if (i+1==j) {
if (arr[i]>arr[j]) return j;
else i++;
} else {
int mid = (i+j)/2;
if (arr[i]
i=mid;
} else if (arr[i]>arr[mid]) {
j=mid;
} else { // ==
i++;
}
}
}
if (i==arr.length-1) return -1;
else ret... 阅读全帖 |
|
b**********y 发帖数: 24 | 11 一直不明白这个solution的transition matrix 是怎么来的
bool isNumber(const char *s) {
int mat[11][7] = {0 ,0 ,0 ,0 ,0 ,0 ,0, // false
0 ,2 ,3 ,0 ,1 ,4 ,0, // 1
0 ,2 ,5 ,6 ,9 ,0 ,10,// 2
0 ,5 ,0 ,0 ,0 ,0 ,0, // 3
0 ,2 ,3 ,0 ,0 ,0 ,0, // 4
0 ,5 ,0 ,6 ,9 ,0 ,10,// 5
0 ,7 ,0 ,0 ,0 ,8 ,0, // 6
0 ,7 ,0 ,0 ,9 ,0 ,10,// 7
0 ,7 ,0 ,0 ,0 ,0 ,0... 阅读全帖 |
|
g*********e 发帖数: 14401 | 12 void gen(string in) {
vector res;
stack stk;
if(in[0]=='1')
stk.push("1");
else if(in[0]=='0')
stk.push("0");
else {
stk.push("1"); stk.push("0");
}
while(!stk.empty()) {
string one=stk.top(); stk.pop();
int idx=one.length();
if(idx == in.length()) {
res.push_back(one);
cout<
} else if(in[idx]=='1') {
one+='1';
stk.push(one);
} els... 阅读全帖 |
|
w****r 发帖数: 15252 | 13 /*
* Sort a linked list in O(n log n) time using constant space
complexity.
*/
public ListNode sortList(ListNode head) {
if(head == null || head.next == null)
return head;
//get the length of the liklist
int count = 0;
ListNode node = head;
while(node!=null){
count++;
node = node.next;
}
//break up to two list
int middle = count / 2;
... 阅读全帖 |
|
f**********t 发帖数: 1001 | 14 来自主题: JobHunting版 - T面经一题 int opNum(int x, int y, char op) {
switch (op) {
case '+':
return x + y;
case '_':
return x - y;
case '*':
return x * y;
case '/':
if (y == 0) {
return 0;
}
return x / y;
}
return 0;
}
int calc(stack &ops, stack &nums) {
int x = nums.top();
nums.pop();
int y = nums.top();
nums.pop();
int res = opNum(x, y, ops.top());
ops.pop();
nums.push(res);
return res;
}
string simplify(string s) {
auto it = s.begin();
stack ops;... 阅读全帖 |
|
f**********t 发帖数: 1001 | 15 // given a string ,return the longest substring that contains at most two
characters.
string twoChar(const string &s) {
if (s.empty()) {
return "";
}
char a, b;
int na = 0, nb = 0;
int left = 0;
int res = 0;
int pos = -1;
for (int right = 0; right < s.size(); ++right) {
if (0 < na && a == s[right]) {
++na;
} else if (0 < nb && b == s[right]) {
++nb;
} else if (na == 0) {
++na;
a = s[right];
} else if (nb == 0) {
++nb;
b = s[... 阅读全帖 |
|
y**********a 发帖数: 824 | 16
改了一下第一题。
boolean equal(int[][]mx, int i, int j) {
int m=mx.length,n=mx[0].length;
if (i<0||j>=m*n||j<0||i>=m*n) return false;
return mx[i/n][i%n]==mx[j/n][j%n];
}
int binarySearchBound(int[][]mx, int k, boolean lower) {
for (int m=mx.length,n=mx[0].length,l=0,r=m*n-1;l<=r;) {
int mid=l+(r-l)/2;
if (mx[mid/n][mid%n]==k) {
if (lower)
if (!equal(mx, mid, mid-1)) return mid;
e... 阅读全帖 |
|
y**********a 发帖数: 824 | 17
改了一下第一题。
boolean equal(int[][]mx, int i, int j) {
int m=mx.length,n=mx[0].length;
if (i<0||j>=m*n||j<0||i>=m*n) return false;
return mx[i/n][i%n]==mx[j/n][j%n];
}
int binarySearchBound(int[][]mx, int k, boolean lower) {
for (int m=mx.length,n=mx[0].length,l=0,r=m*n-1;l<=r;) {
int mid=l+(r-l)/2;
if (mx[mid/n][mid%n]==k) {
if (lower)
if (!equal(mx, mid, mid-1)) return mid;
e... 阅读全帖 |
|
h*********d 发帖数: 336 | 18 phone interview, 实现一个in-memory filesystem. 刚开始面试,还没有摸到门路,
请大牛指点
Write an in memory filesystem! This is a simplified file system that only
supports directories. Your code needs to read from a file and parse the
commands listed below.
cd - Changes the current working directory. The working
directory begins at '/'. The special characters '.' should not modify the
current working directory and '..' should move the current working directory
to the parent.
mkdir - Creates a new dire... 阅读全帖 |
|
w*****j 发帖数: 226 | 19 用自动机写的
求批判
个人觉得自动机的好处是可视化,只要图画对,代码不容易写错
corner case看得也比较清楚
enum State
{
ErrorState
{
@Override
public boolean isValid() { return false; }
},
EndState,
StartState
{
@Override
public State readDigit() { return DigitState; }
@Override
public State readPlus() { return PlusState; }
@Override
public State readMinus() { return MinusState; }
@Override
public State readPoin... 阅读全帖 |
|
w*****j 发帖数: 226 | 20 用自动机写的
求批判
个人觉得自动机的好处是可视化,只要图画对,代码不容易写错
corner case看得也比较清楚
enum State
{
ErrorState
{
@Override
public boolean isValid() { return false; }
},
EndState,
StartState
{
@Override
public State readDigit() { return DigitState; }
@Override
public State readPlus() { return PlusState; }
@Override
public State readMinus() { return MinusState; }
@Override
public State readPoin... 阅读全帖 |
|
T******7 发帖数: 1419 | 21 class Solution {
public:
int helper(vector &num, int st, int end) {
if (st == end)
return num[st];
if (end - st == 1)
return (num[st] > num[end]) ? num[end] : num[st];
int mid = st + (end - st + 1) / 2;
if (num[mid] > num[end]) {
if (num[end] <= num[st])
return helper(num, mid, end);
else
return helper(num, st, mid);
}
else if (num[mid] < num[end]) {
... 阅读全帖 |
|
f**********t 发帖数: 1001 | 22 // Consider this string representation for binary trees. Each node is of the
// form (lr), where l represents the left child and r represents the right
// child. If l is the character 0, then there is no left child. Similarly,
if r
// is the character 0, then there is no right child. Otherwise, the child
can
// be a node of the form (lr), and the representation continues recursively.
// For example: (00) is a tree that consists of one node. ((00)0) is a two-
node
// tree in which the root has a ... 阅读全帖 |
|
p*y 发帖数: 108 | 23 店面是两个中国人,一开始知道是国人还比较欣喜. 结果证明完全不是这么回事,反而感
觉很严格,最终挂了. 请大家分析下为啥挂? 难道第二题没有按面试官心中理想的答案
在面试时给他写出来? 以后看来一定要注意时间.
1. two sum
一开始根据题目理解以为是排好序的数组, 于是从两头开始找:
boolean twoSum(int[] nums, int sum){
if(nums==null || nums.length<2)
return false;
int low = 0, high = nums.length-1;
while(low
if( (nums[low]+nums[high]) == sum ){
return true;
}else if((nums[low]+nums[high]) < sum){
low++;
}else{
... 阅读全帖 |
|
l*******a 发帖数: 16 | 24 Nice~
public boolean validUTF8(byte [] array){
if (array == null || array.length == 0){
return false;
}
int leftByte = 0;
for (int i = 0; i < array.length; i++){
int val = getType(array[i]);
if (leftByte == 0){ // new start
if (val == 1){ // continue byte
return false;
}
else if (val == 0){
continue;
}
else {... 阅读全帖 |
|
c*******g 发帖数: 332 | 25 I tried it as follows:
int getEqual(int A[], int n, int x) {
if (n<2) return -1;
int i=0, j=n-1;
int cnt_l, cnt_r;
cnt_l = A[0]==x?1:0;
cnt_r = A[n-1]!=x?1:0;
while (j-i>1) {
if (cnt_l
while(j-i>1 && A[i+1]!=x) {
i++;
}
if (j-i>1) {i++; cnt_l++;}
} else if(cnt_l>cnt_r) {
while(j-i>1 && A[j-1]==x) {
j--;
}
if (j-i>1) {j--; cnt_r++;}
} els... 阅读全帖 |
|
w********0 发帖数: 377 | 26 这时当时的code,我copy下来了。请大牛指点。
Given a nested list of positive integers: {{1,1},2,{1,1}}
Compute the reverse depth sum of a nested list meaning the reverse depth of
each node (ie, 1 for leafs, 2 for parents of leafs, 3 for parents of parents
of leafs, etc.) times the value of that node. so the RDS of {{1,1},2,{1,1}
} would be 8 = 1*1 + 1*1 + 2*2 + 1*1 + 1*1.
{1,{4,{6}}}
6*1 + 4*2 + 1*3 = 6+8+3 = 17
struct Iterm
{
int v;
bool isInteger();
int getInteger();
list getList();
l... 阅读全帖 |
|
x*******6 发帖数: 262 | 27 贡献一个code,由于没有乘除,只需要记录括号内是否要根据加减改变数字的符号,不
需要使用reverse polish notation解法。
public static int eval(String s, int x) {
String[] exp = s.split("=");
int[] left = helper(exp[0],x);
int[] right = helper(exp[1],x);
return (left[0] - right[0])/(right[1]-right[0]);
}
private static int[] helper(String s, int x) {
boolean positive = true;
Stack re = new Stack();
re.push(false);
int num = 0;
int y = 0;
... 阅读全帖 |
|
t**r 发帖数: 3428 | 28 import java.util.HashMap;
public class LRUCache {
private HashMap map
= new HashMap();
private DoubleLinkedListNode head;
private DoubleLinkedListNode end;
private int capacity;
private int len;
public LRUCache(int capacity) {
this.capacity = capacity;
len = 0;
}
public int get(int key) {
if (map.containsKey(key)) {
DoubleLinkedListNode latest = map.get(key);
removeNode(latest);
setHead(latest);
return latest.val;
} else {
return -1;
... 阅读全帖 |
|
c******1 发帖数: 37 | 29 public class RandomBlack {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
RandomBlack fac = new RandomBlack();
List> lss = fac.permu(9);
for(List ls : lss) {
for(int i = 1; i < 10; i++) {
int getRan = fac.getRan(ls, i);
int check = fac.check(ls, i);
if(getRan == check) continue;
else {
Sys... 阅读全帖 |
|
k**********i 发帖数: 36 | 30 ►►►Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
isMatch("aa","a") → false
isMatch("aa","aa") → true
isMatch("aaa","aa") → false
isMatch("aa", "a*") → true
isMatch("aa", ".*") → true
isMatch... 阅读全帖 |
|
h*****y 发帖数: 298 | 31 recursion比较robust但是短时间内不好写. 因为你没有可以用的语法树,所以要花力
气来tokenize. 只有用Stack才有希望在规定时间里写完,虽然这样的程序完全没有用。
public class EvalExpression {
private Stack results = new Stack();
private Stack operators = new Stack();
private Stack |
|
g******n 发帖数: 10 | 32 这题可以在循环内手动去重,也可以把 triplets 存到 hash set 里自动去重,函数返
回时再转回 list。前者代码略显啰嗦但时间复杂度最坏是 O(n^2),后者代码更简洁但
时间复杂度更高,平均情况 O(n^2),最坏情况 O(n^4)(例如共有 O(n^2) 个
triplets,全部被 hash 到同一个 bucket,每次插入都是 O(n^2),所以总的时间复杂
度是 O(n^4))。C++ 可以用 hash set 也可以先统一把 triplets 存到 vector<
vector> 里,然后 sort + unique + erase / resize 搞定。但是 C++ 这两种方
法都会超时,必须手动去重,Java 和 Python 用 hash set 都能过 OJ。
--------------------------------------------------------------------------
Java 版代码如下:
public class Solution {
public List>... 阅读全帖 |
|
l*****z 发帖数: 3022 | 33 一遍扫描的解法:
int[] check(int [] A){
int N = A.length;
if(N<3) return null;
int min = 0;
int[] ret = new int[3];
ret[0] = 0;
ret[1] = -1;
for(int i=1; i
if(ret[1] < 0){
if(A[i]
min = i;
ret[0] = i;
}else if(A[i]>A[min]){
ret[1] = i;
}
}
else{
//has i, j
... 阅读全帖 |
|
H******7 发帖数: 1728 | 34 随便写一個 见笑了
TreeNode findRange(TreeNode root, int l, int r){
if(root == null) return root;
if(root.val < l){
return findRange(root.left, l, r);
} else if(root.val > r){
return findRange(root.right, l, r);
} else {
if(root.val == l){
if(root.left == null){
return root;
} else {
return findRange(root.right, l, r);
}
} else if(root... 阅读全帖 |
|
p*********g 发帖数: 116 | 35 我叫雷锋
import java.util.*;
public class Solution {
public List majorityElement(int[] nums) {
List res = new ArrayList<>();
if (nums == null || nums.length == 0 )
return res;
int a=0,b=0, ca=0, cb=0;
for (int i=0; i
if ( ca == 0 ) {
a = nums[i];
ca = 1;
} else if ( a == nums[i] ) {
ca++;
} else if ( cb == 0 ) {
... 阅读全帖 |
|
d**********o 发帖数: 279 | 36 没想出怎么用stack, 大牛讲解一下?
"""
Write a iterator to iterate a nested array.
For example, for given array: [1, 2, [3, [4, 5], [6, 7], 8], 9, 10]
call iterator.next() 10 times should return 1,2,3,4,5,6,7,8,9,10.
"""
def traverse(l):
if not l:
return
for i in l:
if isinstance(i, list):
traverse(i)
else:
print i
class NestIterator(object):
def __init__(self, l):
self.l = l
self.cur = -1
self.iterator = None
def next(self):
if self.iterator and s... 阅读全帖 |
|
l******n 发帖数: 30 | 37 试着写了一下,超麻烦,还没考虑单复数
def read_number(x):
m = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',
13: 'thirteen',
14: 'fourteen',
15: 'fifteen',
16: 'sixteen',
17: 'seventeen',
18: 'eighteen',
19: 'nineteen',
20: 'twenty',
3... 阅读全帖 |
|
l**h 发帖数: 893 | 38 写了个java的:
String toCsv(String str) throws Exception {
boolean insideQuote = false;
Stack stack = new Stack();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '[') {
stack.push(c);
} else if (c == ']') {
if (stack.isEmpty() || stack.peek() != '[') {
throw new Exception("Found unmatched ]");... 阅读全帖 |
|
c*****m 发帖数: 271 | 39 感觉是wildcard matching的扩展,a+b+c-转换成*aa*bb*cccc,然后dp的过程中记录次
数,写的python代码如下,测试用例过了:
def match(s, p):
#invalid input
if len(p) % 2 != 0:
return -1
#reconstruct p
temp = ''
i = 0
while i < len(p):
#add '*' first
temp += '*'
#add char pattern
if p[i+1] == '+':
temp += p[i] * 2
else:
#p[i+1] == '-'
temp += p[i] * 4
#iterate to next char
i += 2
p = temp
print p
#... 阅读全帖 |
|
y******g 发帖数: 4 | 40 #include
#include
#include
#include
using namespace std;
struct Item {
int counter;
char c;
Item(): counter(0), c('\0') {};
Item(int counter_, char c_) : counter(counter_), c(c_) {};
Item(const Item &anotherItem): counter(anotherItem.counter), c(
anotherItem.c) {};
};
struct ItemCompare {
Item* prev;
ItemCompare(Item* prevItem): prev(prevItem) {};
bool operator() (const Item &item1, const Item &item2) {
... 阅读全帖 |
|
I**********s 发帖数: 441 | 41 a+b应该不match b吧?
代码如下:
bool match(const char * s, const char * p) {
if (! *p) return ! *s;
if (*(p + 1) == '*') {
// match(s+1, p) - match next char in s.
// match(s, p+2) - match exactly nothing in s.
if (*p == *s) return match(s+1, p) || match(s, p+2);
else return match(s, p+2); // matche exactly nothing in s.
}
else if (*(p + 1) == '+') {
// match(s+1, p) - match next char in s.
// match... 阅读全帖 |
|
I**********s 发帖数: 441 | 42 这涉及到C++转换成Java的一点小技巧。这样改就可以都通过了:
private boolean match(String s, int i, String p, int j) {
if (j == p.length()) return i == s.length();
if (j + 1 < p.length() && p.charAt(j + 1) == '*') {
// match(s+1, p) - match next char in s.
// match(s, p+2) - match exactly nothing in s.
if (i < s.length() && s.charAt(i) == p.charAt(j))
return match(s, i + 1, p, j) || match(s, i, p, j + 2);
else
return match(s... 阅读全帖 |
|
J*****v 发帖数: 314 | 43 终于做出来了,这题用来刷掉三哥效果最好
public class Solution {
public boolean minSquaredSmallerThanMax(int[] nums) {
int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
for (int num : nums) {
min = Math.min(min, num);
max = Math.max(max, num);
}
return (long) min * min < max;
}
public int minDelectionFromFront(int[] nums) {
if(minSquaredSmallerThanMax(nums)) {
return 0;
}
int len = nums.length;
do... 阅读全帖 |
|
发帖数: 1 | 44 二维比较难想,可以先想想一维的情况。这题也可能和二分图有关。我下班后试试。
我擦,匈牙利算法早忘光光了,只记得dfs, 囧。。。
class Location {
Location(int x, int y) {
this.x = x;
this.y = y;
}
public int hashCode() {
return x | y;
}
public boolean equals(Object obj) {
if (obj == null) return false;
else {
if (obj instanceof Location) {
Location l = (Location)obj;
return l.x == x && l.y == y;
} else {
return false;
... 阅读全帖 |
|
发帖数: 1 | 45 class Pair {
Pair(String s, String e) {
_1 = s;
_2 = e;
}
public int hashCode() {
return _1.hashCode() | _2.hashCode();
}
public boolean equals(Object obj) {
if (obj == null) return false;
else {
if (obj instanceof Pair) {
Pair pair = (Pair)obj;
return _1.equals(pair._1) && _2.equals(pair._2);
} else {
return false;
}
}
}
String _1;
S... 阅读全帖 |
|
c******w 发帖数: 1108 | 46 Let A be the input array of digits or *
Let I(n, 1) = count of valid values (between 1 and 26) can be obtained by A[
n].
If A[n] == 0, then I(n, 1) = 0;
else if A[n] == *, then I(n, 1) = 9; // 1~9
else A[n] = 1~9, then I(n, 1) = 1.
Let I(n, 2) = count of valid values can be obtained by A[n-1] * 10 A[n].
If A[n-1] == 1, then I(n, 2) = (A[n] == * ? 10 : 1); // 10~19
else if A[n-1] == 2, then I(n, 2) = (A[n] == * ? 7 : (A[n] <= 6 ? 1 : 0))
; // 20~26
else if A[n-1] == *, then I(n, 2) = (A[n] == *... 阅读全帖 |
|
l**h 发帖数: 7994 | 47 追捕进行时,现在LA附近草木皆兵。
愚蠢可耻的LAPD.
From: Christopher Jordan Dorner /7648
To: America
Subj: Last resort
Regarding CF# 07-004281
I know most of you who personally know me are in disbelief to hear from
media reports that I am suspected of committing such horrendous murders and
have taken drastic and shocking actions in the last couple of days. You are
saying to yourself that this is completely out of character of the man you
knew who always wore a smile wherever he was seen. I know I will be vilified
by ... 阅读全帖 |
|
S*********g 发帖数: 24893 | 48 【 以下文字转载自 Military 讨论区 】
发信人: StephenKing (金博士), 信区: Military
标 题: 真正的美国新闻:让美国蒙羞的新闻
发信站: BBS 未名空间站 (Thu Feb 7 23:47:31 2013, 美东)
From: Christopher Jordan Dorner /7648
To: America
Subj: Last resort
Regarding CF# 07-004281
I know most of you who personally know me are in disbelief to hear from
media reports that I am suspected of committing such horrendous murders and
have taken drastic and shocking actions in the last couple of days. You are
saying to yourself that this is completely out of cha... 阅读全帖 |
|
d******8 发帖数: 3017 | 49 MANIFESTO - scrubbed by mainstream media outlets
From: Christopher Jordan Dorner /7648
To: America
Subj: Last resort
Regarding CF# 07-004281
I know most of you who personally know me are in disbelief to hear from
media reports that I am suspected of committing such horrendous murders and
have taken drastic and shocking actions in the last couple of days. You are
saying to yourself that this is completely out of character of the man you
knew who always wore a smile wherever he was seen. I know I ... 阅读全帖 |
|
G****a 发帖数: 10208 | 50 1. Believe in yourself when no one else does. Lin’s only the 4th graduate
from Harvard to make it to the NBA. He’s also one of only a handful of
Asian-Americans to make it. He was sent by the Knicks to play for their D-
League team 3 weeks ago in Erie, PA. He’d already been cut by two other
NBA teams before joining the Knicks this year. You’ve got to believe in
yourself, even when no one else does.
2. Seize the opportunity when it comes up. Lin got to start for the Knicks
because they had to ... 阅读全帖 |
|