Re: [闲聊] 每日LeetCode

楼主: yam276 ('_')   2023-10-05 14:50:17
※ 引述《ZooseWu (动物园 公告)》之铭言:
: → ZooseWu: 我知道阿 我看到有一题0ms就觉得Rust有料 10/05 14:34
: 推 wwndbk: 我最近开始学 他妈写一题easy都要被编译器卡半天 10/05 14:39
: → ZooseWu: C#在一堆题目上的执行速度甚至不如js 我都哭了 10/05 14:41
但Rust的OOP跟Memory开始就是死人领域
你看我现在打开
2. Add Two Numbers
默认Code:
// Definition for singly-linked list.
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct ListNode {
pub val: i32,
pub next: Option<Box<ListNode>>,
}
impl ListNode {
#[inline]
fn new(val: i32) -> Self {
ListNode { next: None, val }
}
}
impl Solution {
pub fn add_two_numbers(
l1: Option<Box<ListNode>>,
l2: Option<Box<ListNode>>,
) -> Option<Box<ListNode>> {
}
}
这堆Option Box跟#[inline] #[derive(PartialEq, Eq, Clone, Debug)]
蛇摸的
我要哭ㄌ
作者: ZooseWu (N5)   2023-10-05 14:52:00
牺牲易用性跟编译速度换执行速度 我还是去学golang好了

Links booklink

Contact Us: admin [ a t ] ucptt.com