BirdBird

@BirdBird

業餘咖啡師 / 前端菜鳥 / 不專業登山客

Joined on Dec 11, 2020

  • 簡介 安裝 撰寫筆記當下的版本為 ^6.22.3 npm install react-router-dom 導入react-router 預設使用vite建立專案的情況下 main.jsx:
     Like  Bookmark
  • 題目: Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exists, return false. 解題思考 沒邏輯的我先嘗試寫出一個連續三位數字遞增的版本只要比對 <u>當前位置+2</u> 是否符合即可 如果要修改成不連續的版本我該怎麼做? 將宣告兩個變數儲存最小值&次小值,並宣告為 Infinity 迭代 numsif < 最小值:替換掉num1
     Like  Bookmark
  • 題目: Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer. You must write an algorithm that runs in O(n) time and without using the division operation. 解題思考 第一次嘗試 要有一個存放新數字的陣列
     Like  Bookmark
  • 題目: Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return a string of the words in reverse order concatenated by a single space. Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces. 解題思考
     Like  Bookmark
  • 題目: Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once. 解題思考 遍歷 s 儲存原字串所有字母(aeiou)放入 arr 遍歷 s 當遇到字母時 放入 arr 的最後一個元素(pop()) 程式碼
     Like  Bookmark
  • 題目: You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flowerbed without violating the no-adjacent-flowers rule and false otherwise. 解題思考 宣告一個計數器 count 遍歷陣列,檢查當前 flowerbed[i] === 0(=== 1跳過) 檢查當前 flowerbed[i] 的前後是否都等於 0flowerbed[i - 1] === 0 && flowerbed[i + 1] === 0
     Like  Bookmark
  • 題目: There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have. Return a boolean array result of length n, where result[i] is true if, after giving the ith kid all the extraCandies, they will have the greatest number of candies among all the kids, or false otherwise. Note that multiple kids can have the greatest number of candies. 解題思考 先找出原本candies最大的數字 迭代candies加上extraCandies是否為最大值
     Like  Bookmark
  • 題目:1768. Merge Strings Alternately You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string. Return the merged string. 解題思考 需要合併兩個字串:宣告一個空變數或空陣列 需要判斷 word1 word2 的最大值:Math.max 依序從 i = 0將 word1 word2 的字元放入空變數中 直到 i = word1.length
     Like  Bookmark
  • 題目: For two strings s and t, we say "t divides s" if and only if s = t + t + t + ... + t + t (i.e., t is concatenated with itself one or more times). Given two strings str1 and str2, return the largest string x such that x divides both str1 and str2. 解題思考 兩字串連結若不相等,直接返回空字串 取字串的最大公約數(GCD) 依照最大公約數來截取字串
     Like  Bookmark
  • 在 JavaScript 中,將字串連接起來是一個常見的操作。以下是5種常用的方法: 1. 加號(+)運算子 這是最簡單、最直觀的方式,就是使用加號運算子將兩個字串串接在一起。 const str1 = "Hello "; const str2 = "World !"; console.log(str1 + str2); // Hello World ! 2. 模板字符串(Template literals)
     Like  Bookmark
  • 什麼是 Selenium? Selenium 是一個開源的自動化測試工具,主要用於自動化網頁應用程式的測試。它提供了一系列的工具和 API,可以模擬用戶在網頁上的操作,例如點擊按鈕、填寫表單、驗證內容等,從而實現自動化測試。 Selenium 的核心 Selenium 主要提供以下功能: Selenium IDE: 一個瀏覽器插件,可以錄製和播放用戶的操作,並將其轉換為測試腳本。它通常用於初步的測試腳本生成和原型開發。 Selenium WebDriver: 是 Selenium 的核心部分,提供了一個編程接口,用於編寫自動化測試腳本。它支援多種程式語言,包括 Java、Python、JavaScript 等,並且可以與各種瀏覽器(如 Chrome、Firefox、Edge)和操作系統(如 Windows、macOS、Linux)進行集成。
     Like  Bookmark
  • 簡介 在進行網頁爬蟲時,我們可以使用 Node.js 搭配 Selenium WebDriver 來模擬瀏覽器行為,從而獲取網頁上的資料。本篇筆記將介紹如何在 Node.js 環境下安裝 Selenium WebDriver,並使用它來實現簡單的網頁爬蟲功能。 關於 Selenium 的介紹請看這篇:Selenium 簡介 安裝 首先,確保你的系統已經安裝了 Node.js。接著,使用 npm(Node.js 的套件管理器)來安裝所需的套件: npm install selenium-webdriver 簡易範例
     Like  Bookmark
  • 作者 艾克哈特.托勒(Eckhart Tolle) 簡介 《當下的力量》是一本探討心靈覺醒和人生意義的書籍。作者艾克哈特.托勒通過深入的思考和生活哲學,引導讀者放下過去和未來的負擔,活在當下的現實中,體驗內心的平靜和力量。 主題 當下的意義:書中強調了活在當下的重要性,指出過去和未來只是心靈的幻想,真正的生命在當下發生。 觀察自我:作者鼓勵讀者觀察自己的內在對話和情緒反應,從中認識到自我意識的虛幻,並實踐意識到當下的方法。 接受現實:書中強調了接受現實的重要性,無論生活帶來的是喜悅還是挑戰,都要以平靜的心態去面對。
     Like  Bookmark