Open in app

Sign in

Write

Sign in

Andreea
Andreea

5 Followers

Home

About

Feb 19, 2022

27. Remove Element

Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It…

Leetcode Easy

2 min read

Leetcode Easy

2 min read


Feb 19, 2022

104. Maximum Depth of Binary Tree

Given the root of a binary tree, return its maximum depth. A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 3 Example 2: Input: root = [1,null,2] Output…

Leetcode Easy

1 min read

104. Maximum Depth of Binary Tree
104. Maximum Depth of Binary Tree
Leetcode Easy

1 min read


Feb 19, 2022

867. Transpose Matrix

Given a 2D integer array matrix, return the transpose of matrix. The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix’s row and column indices. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,5,8],[3,6,9]] Example 2: Input: matrix = [[1,2,3],[4,5,6]] Output: [[1,4],[2,5],[3,6]] class Solution { public: vector<vector<int>> transpose(vector<vector<int>>& matrix) { int row = matrix.size(); int column = matrix[0].size(); vector<vector<int>> ans(column, vector<int>(row, 0)); for(int i=0; i<row; i++){ for(int j=0; j<column; j++){ ans[j][i]=matrix[i][j]; } } return ans; } };

1 min read

867. Transpose Matrix
867. Transpose Matrix

1 min read


Feb 19, 2022

28. Implement strStr()

Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we…

Leetcode Easy

1 min read

Leetcode Easy

1 min read


Feb 19, 2022

26. Remove Duplicates from Sorted Array

Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Clarification: Confused why the returned value is…

Leetcode Easy

2 min read

Leetcode Easy

2 min read


Feb 19, 2022

136. Single Number

Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space. Example 1: Input: nums = [2,2,1] Output: 1 Example 2: Input: nums = [4,1,2,1,2] Output: 4 Example 3: Input: nums = [1] Output: 1 constant extra space 題目限制不會變動的空間,例如array,會變動的空間像是vector的push_back就不行。

Leetcode

1 min read

136. Single Number
136. Single Number
Leetcode

1 min read


Feb 19, 2022

Android學習手冊-Spinner

Spinner 下拉式選單 在strings.xml中建立字串陣列,再將此字串陣列設定給spinner元件成為選單 <resources> <string name="app_name">spinner</string> <string-array name="gender_list"> <item>男生</item> <item …

Android App Development

3 min read

Android App Development

3 min read


Feb 19, 2022

145. Binary Tree Postorder Traversal

Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [3,2,1] Example 2: Input: root = [] Output: [] Example 3: Input: root = [1] Output: [1] Example 4:

Leetcode Easy

2 min read

Leetcode Easy

2 min read


Feb 19, 2022

155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: MinStack() initializes the stack object. void push(val) pushes the element val onto the stack. void pop() removes the element on the top of the stack. int top() gets the top…

1 min read

1 min read


Feb 19, 2022

Android Studio學習手冊-MarginLeft與MarginStart的區別

在xml的layout_margin屬性中,有幾個非常相似的地方 android:layout_marginStart / android:layout_marginLeft android:layout_marginEnd / android:layout_marginRight 我試了一下,兩個用起來沒有差別。 來看一下android developers的doc.是怎麼寫的

Android App Development

2 min read

Android Studio學習手冊-MarginLeft與MarginStart的區別
Android Studio學習手冊-MarginLeft與MarginStart的區別
Android App Development

2 min read

Andreea

Andreea

5 Followers

IM rookie

Help

Status

About

Careers

Blog

Privacy

Terms

Text to speech

Teams