iT邦幫忙

2025 iThome 鐵人賽

DAY 24
1

https://ithelp.ithome.com.tw/upload/images/20251006/20177944YvClNdFhLF.jpg

https://ithelp.ithome.com.tw/upload/images/20251006/2017794485IbBtB41G.jpg

Yes

https://ithelp.ithome.com.tw/upload/images/20251006/20177944R2xzMcsBTs.png

class Solution { // review 34 O(logN) O(1)
public:
    vector<int> searchRange(vector<int>& a, int t) {
        int L = lower_bound(a.begin(), a.end(), t) - a.begin();
        if (L == a.size() || a[L] != t) return { -1, -1 };
        int R = upper_bound(a.begin(), a.end(), t) - a.begin() - 1;
        return { L, R };
    }
};

尋求推薦好電影:)


上一篇
I have memorized it 1493 & 希望每天都是星期天~無憂無慮快樂去聊天?(過老的歌曲
下一篇
理解快樂but記憶需要勇氣&為了可愛的鐵人攜帶筆電嗚嗚
系列文
轉職仔之Data Science and ai master後的持續精進技術之路25
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

0
AndyAWD
iT邦新手 2 級 ‧ 2025-10-08 23:02:17

鐵人賽還沒拿到徽章,反而 LeetCode 先拿到

我要留言

立即登入留言