讨论/题目交流/🏆 第 153 场力扣周赛/
🏆 第 153 场力扣周赛

这是 9 月的第二场周赛,欢迎小伙伴们在这里交流分享你的参赛心得以及体验。

image.png

展开讨论
力扣 (LeetCode)发起于 2019-09-08

今天做出来两个题
分享一下
第一题

class Solution:
    def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int:
        if len(distance)==1:
            return distance[0]
        if start > destination:
        	start,destination = destination,start
        a = sum(distance[start:destination])
        del distance[start:destination]
        b = sum(distance)
        return min(a,b)

第二题


import java.time.LocalDate;
class Solution {
    public String dayOfTheWeek(int day, int month, int year) {
        String ans[] = {"", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sunday"};
        LocalDate ld = LocalDate.of(year,month,day);
        int a = ld.getDayOfWeek().getValue();
        System.out.println(a);
        return ans[a];
    }
}

没了

1
展开全部 17 讨论