paulpeng

@normal

假裝我會寫程式

Joined on Sep 23, 2020

  • Command Substitution Command substitution allows the output of a command to replace the command itself in a shell script or command line. `command` $(command) Example: echo "Today is $(date)" echo "Nested: $(echo $(date))"
     Like  Bookmark
  • 34. Find First and Last Position of Element in Sorted Array 難度:medium 題意:給一遞增陣列,再給一數字,找出該數字們所在陣列中的開始與結束位置 範例:Input: [5, 7, 7, 8, 8, 10], target = 8 Output: [3, 4] Input: [5, 7, 7, 8, 8, 10], target = 6 Output: [-1, -1] Input: [], target = 8 Output: [-1, -1]
     Like  Bookmark
  • contributed by < paulpeng-popo > Prerequisites In order to avoid affecting the original computer environment, a container is set up to provide the experimental environment for Assignment 3. Here, I use Docker for building container. FROM arm64v8/ubuntu:22.04 # set the working directory
     Like  Bookmark
  • contributed by < paulpeng-popo > Choose a question I selected Bitwise AND of Numbers Range from JoshuaLee, because its concept is similar to my topic which I have chosen in assignment 1. Analyzation of Original code This question is asking us to find the common prefix of left and right 's binary code. To find the common prefix of left and right, we can shift both of them to the right until they are equal. int rangeBitwiseAnd(int left, int right) {
     Like  Bookmark
  • contributed by < paulpeng-popo > Functionality Reverse bits of a given 32 bits unsigned integer. Example: Input: 0000 0010 1001 0100 0001 1110 1001 1100 Output: 0011 1001 0111 1000 0010 1001 0100 0000 Motivation
     Like  Bookmark
  • contributed by < paulpeng-popo > Github: paulpeng-popo 開發環境 $ gcc --version gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 $ lscpu Architecture: x86_64
     Like  Bookmark
  • contributed by < paulpeng-popo > 開發環境 $ gcc --version gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian
     Like  Bookmark
  • contributed by < paulpeng-popo > 題目 測驗一 解釋程式碼原理 輸入一個數,目標是找到最接近且大於等於 2 的冪的值,舉例來說 $next_pow2(7) = 8$ $next_pow2(13) = 16$
     Like  Bookmark
  • contributed by < paulpeng-popo > 題目 測驗一 digraph linkedlist { rankdir=LR; node [shape=record]; a [label="{ <data> list | <ref> }", width=1.2] b [label="{ <data> 4 | <ref> }"];
     Like  Bookmark