我正在尝试解决有关 codility 的所有课程,但我未能解决以下问题:Ladder by codility
我在互联网上进行了搜索,但没有找到让我满意的答案,因为没有人回答为什么 max 变量对结果的影响如此之大。
所以,在发布代码之前,我会解释一下这个想法。
通过查看它,我不需要太多时间来理解它的组合总数是一个斐波那契数,并从斐波那契数组中删除 0,我会很快找到答案。
现在,后来,他们告诉我们应该返回模数 2^B[i] 的组合数。
到目前为止一切顺利,我决定在没有 var max 的情况下提交它,然后我得到了 37% 的分数。 (2,30)。
任何人都可以向我解释这个最大值如何以及为什么会如此影响分数?
我的代码:
// Powers 2 to num
function pow(num){
return Math.pow(2,num);
}
// Returns a array with all fibonacci numbers except for 0
function fibArray(num){
// const max = pow(30); -> Adding this max to the fibonaccy array makes the answer be 100%
const arr = [0,1,1];
let current = 2;
while(current<=num){
current++;
// next = arr[current-1]+arr[current-2] % …Run Code Online (Sandbox Code Playgroud)我有这种情况我想讨论:
我有一个listview,它的目的是显示25家商店.对于我想要的设计:
2个布局,第一个布局:商店的1张大照片(从数据库下载).1个图标,如果商店属于最佳评级商店列表(该图标在我的应用程序上)1 textview(下载字符串)
第二个有:3个textviews.(下载字符串)
Everytextview具有自定义字体.
正如您可以想象的那样,这对每个项目来说都是一项艰巨的任务.
我的主要问题是:
如果我下载了所有内容而不是制作列表视图,我是否会获得更好的性能?我用这些数据填充滚动视图?
创建布局可能需要更多一些,但可能是滚动更平滑或者我错了?
So, I have an aplication that executes asynk task and on post execute it generates a listview.
After the json is recieved the app crashes on a LG G2 but not on other phones.
My Log cat is giving this report:
10-09 13:45:47.066: E/Entity Response :(16241): [{"id":"440","name":"Amici's East Coast Pizzeria","address":"226 Redwood Shores Pkwy, Redwood City, CA","lat":"37.5205","lng":"-122.252","promotype":"0.10","tipo":"Cabeleireiros","foto":"http:\/\/s1.postimg.org\/526tyzobj\/image.jpg","distance":"62.03","ranking":"6.202501588797353"},{"id":"446","name":"Applewood Pizza 2 Go","address":"1001 El Camino Real, Menlo Park, CA","lat":"37.453","lng":"-122.182","promotype":"0.50","tipo":"Cabeleireiros","foto":"http:\/\/s27.postimg.org\/yth8q6mb7\/image.jpg","distance":"52.89","ranking":"26.442939242734457"},{"id":"453","name":"Giorgio's","address":"1445 Foxworthy Ave, San Jose, CA","lat":"37.2746","lng":"-121.893","promotype":"1.00","tipo":"Cabeleireiros","foto":"http:\/\/s10.postimg.org\/lk0r9tbsp\/a_A.jpg","distance":"31.97","ranking":"31.973513511004338"},{"id":"447","name":"Pizza Antica","address":"334 Santana Row # 1065, San Jose, CA","lat":"37.3218","lng":"-121.948","promotype":"1.00","tipo":"Cabeleireiros","foto":"http:\/\/s11.postimg.org\/gt2rkwr8j\/image.jpg","distance":"36.08","ranking":"36.07806101584471"},{"id":"452","name":"Tony & Alba's …Run Code Online (Sandbox Code Playgroud)