小编Vip*_*waj的帖子

尝试更新libpython3.6-stdlib会导致覆盖错误

以下是我尝试更新依赖项的错误日志.我觉得--overwrite标志可以用"dpkg"完成工作,但我不确定是否使用它,因为我看到一些交叉依赖.非常感谢你的帮助.

sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libpython3.6-stdlib
The following packages will be upgraded:
  libpython3.6-stdlib
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
8 not fully installed or removed.
Need to get 0 B/1,989 kB of archives.
After this operation, 1,393 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading …
Run Code Online (Sandbox Code Playgroud)

python upgrade apt-get python-3.x python-3.6

11
推荐指数
1
解决办法
4327
查看次数

如何优化Haskell代码以通过HackerRanks超时测试用例(不是为了任何正在进行的比赛,只是我练习)

我已经学习 Haskell 大约 4 个月了,我不得不说,学习曲线绝对是艰难的(也很可怕:p)。

在解决了大约 15 个简单问题后,今天我转向 HackerRank 上的第一个中等难度问题https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem

这是 10 个测试用例,我能够通过其中的 6 个,但其余的都因超时而失败,现在有趣的部分是,我已经可以看到一些具有性能提升潜力的部分,例如,我正在使用nub删除复制自 a [Int],但我仍然无法构建算法性能的心理模型,不确定 Haskell 编译器的主要原因将改变我的代码以及懒惰在这里如何发挥作用。

import Data.List (nub)

getInputs :: [String] -> [String]
getInputs (_:r:_:p:[]) = [r, p]

findRating :: Int -> Int -> [Int] -> Int
findRating step _ [] = step
findRating step point (x:xs) = if point >= x then step else findRating (step + 1) point xs

solution :: [[Int]] -> [Int]
solution [rankings, points] = map …
Run Code Online (Sandbox Code Playgroud)

algorithm haskell haskell-platform

9
推荐指数
1
解决办法
368
查看次数