brad84622

@brad84622

Joined on Sep 15, 2018

  • Leetcode (C語言/Python3) Leetcode 1. Two Sum (C/Python3) Leetcode 2. Add Two Numbers (C語言) Leetcode 3. Longest Substring Without Repeating Characters (C語言) Leetcode 7. Reverse Integer (C語言) Leetcode 9. Palindrome Number (C語言) Leetcode 13. Roman to Integer (C語言) Leetcode 24. Swap Nodes in Pairs (C語言) Leetcode 67. Add Binary (C語言) Leetcode 69. Sqrt(x) (C語言)
     Like  Bookmark
  • 觀察row狀態 row 1 0 row 2 0 1 row 3 0 1 1 0 row 4 0 1 1 0 1 0 0 1 可看成一個二元樹 根據規則 0的左節點0 , 右節點1 1的左節點1 , 右節點0
     Like  Bookmark
  • Example 1: Input: nums = [1,3,4,9] Output: 0 Explanation: Initially, nums = [1, 3, 4, 9]. In the first operation, we can choose index 0 and 1 because nums[0] < nums[1] <=> 1 < 3. Remove indices 0 and 1, and nums becomes [4, 9]. For the next operation, we can choose index 0 and 1 because nums[0] < nums[1] <=> 4 < 9. Remove indices 0 and 1, and nums becomes an empty array []. Hence, the minimum length achievable is 0.
     Like  Bookmark
  • Rectangle ( MAC split screen / resize window shortcut ) ( MAC 分屏 / 調整視窗大小 快捷鍵 ) windows 上 win + 左右調整視窗分屏在MAC沒有預設鍵位 開源免費軟體 Rectangle 能做到這件事情 官網直接下載安裝 https://rectangleapp.com
     Like  Bookmark
  • 建一個 hello_world.v 內容 module helloworld; initial begin $display("Hello world\n"); $finish end endmodule
     Like  Bookmark
  • 當我今天要交換所有input跟output 可執行 %s /input/temp/g | %s /output/input/g | %s /temp/output/g 其實就是一般C語言用的swap手法 , 把input先替換成 temp , 再把output換成input , 最後把temp換成output 只是可以把語法串在一行搞定
     Like  Bookmark
  • 最近在學vim遇到一個問題 %s/a/b/g 這行指令會去將整個文檔搜索找到a就替換成b 其中 %s代表全域搜索並取代 , /g表示全域執行 當時我就好奇既然%s有全域的意思那又幹嘛要/g? 開始實驗
     Like  Bookmark
  • 2022 這次回頭發現 PyTube 可以直接提取音訊 細節基本參考Download Video in MP3 format using PyTube(GeeksforGeeks)再做修改 首先安裝pytube pip3 install pytube ::: warning 如果出現 ModuleNotFoundError: No module named 'pip'
     Like 3 Bookmark
  • 鍵盤按 ==Shift + PrtSc== 截完的圖在 /home/user_name/Pictures
     Like  Bookmark
  • 題目 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. C 範例 Example:
     Like 10 Bookmark
  • terminal執行 sudo apt-get install python3-pip
     Like  Bookmark
  • 題目 Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be changed. 範例 Example: Given 1->2->3->4, you should return the list as 2->1->4->3.
     Like  Bookmark
  • 副函式內用Sizeof找input array大小錯誤!? ==結論:此函式內宣告的array可以用sizeof(array)/sizeof(*array)來找大小== ==但是作為函式input的array address是作為指標陣列,sizeof會出錯== #include <stdio.h> void pt(int a[]){ printf("sizeof(a)=%d\tsizeof(*a)=%d\n",sizeof(a),sizeof(*a)); //sizeof(a)=8 sizeof(*a)=4
     Like  Bookmark
  • Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute difference between i and j is at most k. Example 1: Input: nums = [1,2,3,1], k = 3, t = 0 Output: true Example 2: Input: nums = [1,0,1,1], k = 1, t = 2 Output: true
     Like  Bookmark
  • Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 hour time is 00:00, and the largest is 23:59. Starting from 00:00, a time is larger if more time has elapsed since midnight. Return the answer as a string of length 5. If no valid time can be made, return an empty string. Example 1: Input: A = [1,2,3,4] Output: "23:41"
     Like  Bookmark
  • #include<bits/stdc++.h> #define ll long long using namespace std; ll sumdigit(ll n){ ll temp=0; for(;n;n/=10) temp+=n%10; return temp; }
     Like  Bookmark
  • #include <bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; vector<int> cnt(2); for(int i=0;i<n;++i){ int a; cin>>a;
     Like  Bookmark
  • 題目 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. 範例 Example: Given the below binary tree and sum = 22, 5
     Like  Bookmark
  • 題目 Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. 範例 Example:
     Like  Bookmark
  • 題目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000
     Like 2 Bookmark