Hello Prisma
Connecting Prisma application to Supabase PostgresCreste a custom user fro Prismacreate a Prisma DB user with full privileges on the public schema123456789101112131415-- Create custom usercreate user "prisma" with password 'custom_password' bypassrls createdb;-- extend prisma's privileges to postgres (necessary to view changes in Dashboard)grant "prisma" to "postgres";-- Grant it necessary permissions over the relevant schemas (public)grant usage o...
Leetcode - 135. Candy
DescriptionThere are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: Each child must have at least one candy. Children with a higher rating get more candies than their neighbors. Return the minimum number of candies you need to have to distribute the candies to the children. 12345Example 1:Input: ratings = [1,0,2]Output: 5Explanation: You can allocate to...
Leetcode - 169. Majority Element
DescriptionGiven an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. Example 1:12Input: nums = [3,2,3]Output: 3 Example 2:12Input: nums = [2,2,1,1,1,2,2]Output: 2 Constraints:123n == nums.length1 <= n <= 5 * 104-109 <= nums[i] <= 109The input is generated such that a majority element will exist in the array. Approach123456789101112class S...
Leetcode - 205. Isomorphic Strings
DescriptionGiven two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself. Approach12345678910111213141516class Solution: def isIsomorphic(self, s: str, t: str) -> bool: char_index_s = {} c...
Leetcode - 392. Is Subsequence
DescriptionGiven two strings s and t, return true if s is a subsequence of t, or false otherwise.A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., “ace” is a subsequence of “abcde” while “aec” is not). Example 1: 12Input: s = "abc", t = "ahbgdc"Output: true Example 2: 12Input: s = "axc", t = "ahbgdc&qu...
Leetcode - 670. Maximum Swap
DescriptionYou are given an integer num. You can swap two digits at most once to get the maximum valued number. Return the maximum valued number you can get. 12345Example 1:Input: num = 2736Output: 7236Explanation: Swap the number 2 and the number 7. 12345Example 2:Input: num = 9973Output: 9973Explanation: No swap. 12Constraints:0 <= num <= 108 Approach1234567891011121314151617181920class Solution: def maximumSwap(self, num: int) -> int: result = num num_list = list(...
Certified Data Engineer Associate 02
Certified Data Engineer Associate 02101. A data engineer has realized that the data files associated with a Delta table are incredibly small. They want to compact the small files to form larger files to improve performance. Which keyword can be used to compact the small files?Answer: OPTIMIZE OPTIMIZE table_name: Compacts small files into larger files to improve performance.VACUUM table_name: Removes old files that are no longer needed after compaction. 102. A data engineer wants to create ...
Certified Data Engineer Associate 01
Certified Data Engineer Associate 011. A data organization leader is upset about the data analysis team’s reports being different from the data engineering team’s reports. The leader believes the siloed nature of their organization’s data engineering and data analysis architectures is to blame. Which of the following describes how a data lakehouse could alleviate this issue?Answer: Both teams would use the same source of truth of their work. Databricks Lakehouse enables using data as the sin...
Machine Learning
Overview of Machine LearningWhat is Machine Learning?Machine Learning (ML) is a subset of artificial intelligence (AI) that enables computers to learn from data and improve their performance over time without being explicitly programmed. ML algorithms build mathematical models based on sample data, known as “training data,” to make predictions or decisions without being explicitly programmed to perform the task. Artificial intelligence is a field of computer science that aims to create machi...
Probability Theory
ProbabilityProbability is a measure of how likely an event is to occur.The probability of an event ( A ) is denoted as: P(A)Probability Calculations Event Formula Complement of A P(A^c) = 1 - P(A) Joint Probability (A and B) P(A \cap B) Union Probability (A or B) P(A \cup B) = P(A) + P(B) - P(A \cap B) Conditional Probability P(A \mid B) = \frac{P(A \cap B)}{P(B)} ExampleA bag contains 10 balls: 6 red and 4 blue. Two balls are drawn randomly without replacement. Let: Event ...








