Problem 59: Spiral Matrix II
QuestionLeetCode Link | 59. Spiral Matrix II | Medium
Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.
Constrains
1 <= n <= 20
ExampleExample 1
Input: n = 3Output: [[1,2,3],[8,9,4],[7,6,5]]
Example 2
Input: n = 1Output: [[1]]
Solution ApproachMethod: Manual / SimulateConstrains
None
This method does not have any limitations.
Concept ExplanationThis problem often appears in interviews. It does not involve any s ...
Problem 209: Minimum Size Subarray Sum
QuestionLeetCode Link | 209. Minimum Size Subarray Sum | Medium
Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no such subarray, return 0 instead.
Constrains
1 <= target <= 10^9
1 <= nums.length <= 10^5
1 <= nums[i] <= 10^4
ExamplesExample 1
Input: target = 7, nums = [2,3,1,2,4,3]Output: 2Explanation: The subarray [4,3] has the minimal leng ...
Problem 977: Squares of a Sorted Array
QuestionLeetCode Link | 977. Squares of a Sorted Array | Easy
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
Constraints
1 <= nums.length <= 10^4
-10^4 <= nums[i] <= 10^4
nums is sorted in non-decreasing order.
ExamplesExample 1
Input: nums = [-4,-1,0,3,10]Output: [0,1,9,16,100]Explanation: After squaring, the array becomes [16,1,0,9,100].After sorting, it becomes [0,1,9,16,100].
E ...
Problem 27: Remove Element
QuestionLeetCode Link | 27. Remove Element | Easy
Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.
Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things:
Change the array nums such that the first k elements of nums contain the elements which are not equal ...
AWS CloudPractitioner - Practice Exam
Section 1
Which of the below options are related to the reliability of AWS? (Choose TWO)
A. Applying the principle of least privilege to all AWS resources.
B. Automatically provisioning new resources to meet demand.
C. All AWS services are considered Global Services, and this design helps customers serve their international users.
D. Providing compensation to customers if issues occur.
E. Ability to recover quickly from failures.
Answer
Correct answer: B, E
Which statement is true regar ...
AWS CloudPractitioner - Essentials
All contents are modified and cite from AWS Cloud Practitioner Essentials course.
Module 1: Intro to Amazon Web ServicesBenefits of cloud computingTrade upfront expense for variable expenseUpfront expense refers to data centers, physical servers, and other resources that you would need to invest in before using them. Variable expense means you only pay for computing resources you consume instead of investing heavily in data centers and servers before you know how you’re going to use them.
Stop s ...
Problem 704: Binary Search
QuestionLeetCode Link | 704. Binary Search | Easy
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.
You must write an algorithm with O(log n) runtime complexity.
Constrains
1 <= nums.length <= 10^4
-10^4 < nums[i], target < 10^4
All the integers in nums are unique.
nums is sorted in ascending order.
ExamplesExample 1
Input: ...
React Native Redux
ConceptsIn a React / React Native app, it will generally having 3 parts:
The state, the source of truth that drives our app;
The view, a declarative description of the UI based on the current state;
The actions, the events that occur in the app based on user input, and trigger updates in the state;
This build up a “one-way data flow”:
State describes the condition of the app at specific point in time
The UI is rendered based on that state
When something happens (such as a user clicking ...
Project File Structure
Deciding whether to place all interfaces/types in a single file or distribute them across different files where they are used depends on the scale and structure of your project, as well as personal or team preferences. Both approaches have their advantages and considerations:
Centralized Types (Single File)Advantages:
Consistency: Centralizing types ensures consistency across your project, as every component or module refers to the same definitions.
Maintainability: Updating a type in one ...
FirebaseAuth Implementation - Google
Before you start
Have Firebase installed in project
Have CocoaPods installed in project
Have React Native Firebase installed in project
Complete the Getting Started section in their document.
Make sure you complete both iOS & Android setup!!!
Ensure the “Google” sign-in provider is enabled on the Firebase Console.
SHA1 key for AndroidThe debug signing certificate is optional to use Firebase with your app, but is required for Dynamic Links, Invites and Phone Authentication. To generate a c ...