b***e 发帖数: 1419 | 1 /*
Find all substring palindomes. No dupe.
Vanilla JS. Run it with node.js or in browser console.
*/
function reverse(s) {
var o = '';
for (var i = s.length - 1; i >= 0; i--)
o += s[i];
return o;
};
var p = function(s) {
var prevLookup = {};
var nextLookup = {};
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (!prevLookup[c]) {
prevLookup[c] = [];
nextLookup[c] = [];
}
}
for (var i = 0; i <... 阅读全帖 |
|
b***e 发帖数: 1419 | 2 看这段就够了:
// start code
var _rec = function(left, right, accum) {
console.log(accum + reverse(accum));
if (left > right) return;
for (var c in prevLookup) {
var leftMostPos = nextLookup[c][left];
var rightMostPos = prevLookup[c][right];
if (leftMostPos != null && leftMostPos <= right) {
console.log(accum + c + reverse(accum));
if (rightMostPos > leftMostPos) {
_rec(leftMostPos + 1, r... 阅读全帖 |
|
b***e 发帖数: 1419 | 3 /*
Find all substring palindomes. No dupe.
Vanilla JS. Run it with node.js or in browser console.
*/
function reverse(s) {
var o = '';
for (var i = s.length - 1; i >= 0; i--)
o += s[i];
return o;
};
var p = function(s) {
var prevLookup = {};
var nextLookup = {};
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (!prevLookup[c]) {
prevLookup[c] = [];
nextLookup[c] = [];
}
}
for (var i = 0; i <... 阅读全帖 |
|
b***e 发帖数: 1419 | 4 看这段就够了:
// start code
var _rec = function(left, right, accum) {
console.log(accum + reverse(accum));
if (left > right) return;
for (var c in prevLookup) {
var leftMostPos = nextLookup[c][left];
var rightMostPos = prevLookup[c][right];
if (leftMostPos != null && leftMostPos <= right) {
console.log(accum + c + reverse(accum));
if (rightMostPos > leftMostPos) {
_rec(leftMostPos + 1, r... 阅读全帖 |
|
c***r 发帖数: 4631 | 5 The problem maybe "endian", java use "big-endian" and C on intel CPU will use
"little endian". So the data is confusing. And you may use code below to solve
this problem
float readFloatLittleEndian( )
{
int accum = 0;
for ( int shiftBy = 0; shiftBy < 32; shiftBy+ =8 )
{
accum |= (readByte () & 0xff) << shiftBy;
} return Float.intBitsToFloat (accum);
}
I got it from http://mindprod.com/jglo |
|
k**********g 发帖数: 989 | 6
I can think of a two-pass approach.
First pass, Find the digits that do not have enough ones (i.e. bit positions
for which less than 50 inputs have a value of one in that bit position).
This first step is optional - even if you skip this step, you still only
need to accumulate ( 30 * 29 / 2 ) = 435 histogram bins.
// initialize
foreach bitIndex
accum [ bitIndex] = 0
// accumulate
foreach inputIndex
foreach bitIndex
accum [ bitIndex ] += input [ inputIndex ] . bit [ bitIndex ]
// Second ... 阅读全帖 |
|
h******n 发帖数: 1838 | 7 工作中有个需求,根据学生login某网站的次数和一些其他的variables预测某门课是
pass还是fail on a daily basis. 数据是这个样子的, 每个ID每天最多login一次,并
且是累计起来的。
ID, day of class, accum login times, pass
1, 1, 1, 0
1, 2, 2, 0
1, 3, 2, 0
1, 4, 2, 0
... (ID1 在第一天,第二天log in了,3,4天没有,最后fail了)
2, 1, 1, 1
2, 2, 2, 1
2, 3, 3, 1
2, 4, 4, 1
... (ID2 每天都log in了,最后pass了)
公司每天都会监测学生的activity, 并且每天都要生成学生最终pass/fail的
probability, 我想知道的是应该用什么方法来把这个accum login times也加到model
里面,好像这个也不太像mixed-effect.
包子不多,给前5个有帮助的人,多谢! |
|
s*********h 发帖数: 6288 | 8 最近在看spark的programming guide, https://spark.apache.org/docs/latest/
programming-guide.html#transformations
下面这段不是很明白啊。
accum = sc.accumulator(0)
data.map(lambda x => acc.add(x); f(x))
这里acc大概是typo,应该是accum吧。
但是为什么map后面有lambda和f(x)两个函数?
我简单查了一些例子,map后面似乎都只使用了一个函数。
那这个例子里面除了lambda的累加x的结果之外还有什么?
多谢 |
|
b*****h 发帖数: 3386 | 9 【 以下文字转载自 Stock 讨论区 】
发信人: lyrist (我是捂大的), 信区: Stock
标 题: 如何做Swing trade (3) - Ascending Triangle
发信站: BBS 未名空间站 (Sun May 31 19:58:25 2009)
我们青蛙们最关心的事情是如何得到一个好pick,与其等着大牛给pick,不如自己动手
来找。
我个人在买卖股票,设置stop的时候基本只看trend, support/resistence and volume
这些东西,但在scan股票的时
候,这些咚咚不好直接定义,所以必须借助一些technical indicators。 所以, 在筛
选股票之前,我们必须了解一些基
本的technical indicators。对于筛选股票常用的technical indicators大概分为下面
几类:
1. Money flow:
大家在看蜡烛图的量的时候,会很直观的感觉,如果一段时间绿柱柱比红柱柱多,而且
高,这说明有更多的demand, 当
demand大于supply, 股价就会上涨(跟街上买白菜是一个道理... 阅读全帖 |
|
P******l 发帖数: 1648 | 10 刚去查了车的空调 被告知要换压缩机
2003 Nissan Xterra SUV
evacuate and recharge R134A $155
replace compressor, drier/accum, evaporator core 1150
subtotal 1304
with tax,etc total $1374.96
请大家帮忙看看这个价格怎么样? thanks! |
|
P******l 发帖数: 1648 | 11 Thank you very much! 看了你的回文 我去google了一番
这是tireplus quote 明细
compressor&clutch, parts 580.83 labor 120
drier/accum, parts 49.89 labor 70
remove/replace evaporator core use the old part. labor 300
expansion valve $28.69
total 1150 ($660 parts+$490 labor)
evacuate and recharge R134A
R134A 2lb $30/lb
a/c system dye 14.99
labor 80
total $155
http://www.discountacparts.com
A/C Compressor - Discount AC Parts Brand New with Clutch 60-01488 NA $
395
A/C Accumulator/Drier $45
A/C Expansion Device... 阅读全帖 |
|
x*******g 发帖数: 1363 | 12 You must be kidding. "假如当时是你们开,很可能也会是同样的速度" --- he is a
road killer.
in NY, you will get 6 points just for this ticket, and
DMV will charge a Driver Assessment Fee if you accumulate 6 or more points
in an 18 month period calculated by date of violation. The fee is $300.00 ($
100 a year for three years). For every point over six, an additional $75.00
is charged. Additionally, an accum-
ulation of 11 or more points in an 18 month period will result in the
suspension of a NY driver license.
If he i... 阅读全帖 |
|
x****r 发帖数: 75 | 13 I have read through all the posts in this thread and understand both sides
of the stories. This remind me some period of my marriage. Fortunately, it
has passed and I 'd like to offer both of you my opinions from my experence,
hope you two could cool down, think hard what really do you want in a
marriage and causiously proceed.
From what I can see, there is no fundamental problems in the marriage. The
problems are all caused by little things. If these little things does not
get solved, it accum |
|
p********w 发帖数: 90 | 14 疑问:TIAA retirement annuity说annualized performance 5.79% for 10 years
退休金TIAA里的TIAA traditional annuity
但是我觉得不可能呀。
TIAA retirement annuity是个guarantee account,回报率是guaranteed return +
additional return.
有个图标画出半年的accumating stage total rate return,是3%-5%左右,大多数在4
%徘徊。
计算有错误呀??? |
|
h*****e 发帖数: 317 | 15 今天保险公司说 "When there is one baby it is normally a well baby so they
get applied under mom's accums, where when you have twins, this is not
considered normal newborn, therefore they will each have their own
deductible / coinsurance to meet"
这是不是很不合理? |
|
k*******0 发帖数: 256 | 16 for categories which are "Current" (EB1 and EB2-ROW).
the inventory only shows apps that have waited there for long time. the
demand data, suppose be DOS prediction of demand but look at Sept data you'
ll know not the case (how can 2008 and 2010 accum almost same?) |
|
m**********r 发帖数: 6 | 17 What's the difference between demand data and pending inventory?
The pending inventory as of June 2011 for Chinese eb3 is,
Year, 01 02 03 04 05 06 07 08 09 10 11 total
Total 67 13 35 885 1,009 1,195 607 0 0 0 0 3,811
Accum, 67 80 115 1,000 2,009 3,204 3,811 |
|
N******p 发帖数: 2777 | 18 同学们出门开车要小心啊
Issued by The National Weather Service
Indianapolis, IN
6 am EST, Wed., Feb. 3, 2010
... SIGNIFICANT SNOWFALL POSSIBLE FRIDAY AND FRIDAY NIGHT...
A LARGE STORM SYSTEM IS EXPECTED TO LIFT NORTHEAST OUT OF THE GULF COAST REG
ION AND INTO EASTERN KENTUCKY LATE THURSDAY NIGHT INTO FRIDAY. THIS STORM HA
S THE POTENTIAL TO BRING SIGNIFICANT ACCUMULATING SNOWFALL TO ALL OF CENTRAL
INDIANA... ALONG WITH AREAS OF RAIN OR FREEZING RAIN.
AT THIS TIME... INDICATIONS ARE THAT TOTAL SNOWFALL ACCUM |
|
J******h 发帖数: 6102 | 19 Mt. kailash kora hiking loop, 看看这数据,即使不考虑4500米的海拔高度,也一点
不轻松。
Trail distance: 32.38 miles
Elevation min: 15,278 feet, max: 18,544 feet
Accum. height uphill: 3,917 feet, downhill: 4,222 feet
Difficulty level: Difficult
Time: 2 days one hour 45 minutes
http://www.wikiloc.com/wikiloc/view.do?id=298870 |
|
t**********p 发帖数: 2672 | 20 申请帮你拿回来!
下周一起上baldy吧
现在看天气预报都会兴奋
There could some light showers possible as early as Sunday night in L.A. The
storm system looks to make its move into the region on Monday bringing with
it a period of moderate and heavy rain as well as possible thunderstorms. T
his is a very cold storm and very unstable, snow levels could dip as low as
2000-3000 feet late Monday night or early Tuesday morning. That means snow f
or the high deserts, and even some higher I.E Valleys could be possible. The
core of ... 阅读全帖 |
|
J******s 发帖数: 7538 | 21 I found this is better to understand than Chinese version. :-)
-------------
Four Kinds of Kamma (Kamma-catukka)
Buddha Abhidhamma by Dr. Mehm Tin Mon
Though we cannot know the individual kammas in person, we can classify the
kammas into several types as described by Buddha, and predict when, where
and how each type will bear its result.
Introduction
Kamma, Sanskrit karma, literally means volitional action or deed. As a rule
good actions bear good results and bad actions bear bad results. Now ac... 阅读全帖 |
|
J******s 发帖数: 7538 | 22 I found this is better to understand than Chinese version. :-)
-------------
Four Kinds of Kamma (Kamma-catukka)
Buddha Abhidhamma by Dr. Mehm Tin Mon
Though we cannot know the individual kammas in person, we can classify the
kammas into several types as described by Buddha, and predict when, where
and how each type will bear its result.
Introduction
Kamma, Sanskrit karma, literally means volitional action or deed. As a rule
good actions bear good results and bad actions bear bad results. Now ac... 阅读全帖 |
|
Y**u 发帖数: 5466 | 23 ☆─────────────────────────────────────☆
whosewho (whosewho) 于 (Sat Jan 21 22:26:45 2012, 美东) 提到:
俺前几天读某位师兄推荐的《禅修之旅》,感觉很好。不过有一个问题一直不明,就是
南传关于‘业’的解释。不知哪位师兄可以一解俺的疑惑?
多谢!
☆─────────────────────────────────────☆
SeeU (See you) 于 (Sun Jan 22 21:02:05 2012, 美东) 提到:
摘录自南传的《阿毗达摩概要精解》∶
善心与不善心两者是「业」(kamma)。缘于业成熟而生起的心是果报心。这类心组成有别于前两种的第三种心;它包括善业与不善业的果报(vipàka)。应明白在此所指的业与果报两者皆是纯粹属于精神方面的。业是与善心或不善心相应的「思」;其果报是其他体验成熟之业的
当「思」开始对目标作业时,它也指挥其他相应法执行各自的任务。「思」是造业的最主要因素,因为所采取的行动之善恶即决定于思。
不善果报心∶第一组无因心包含了七种不... 阅读全帖 |
|
|