djdj - HTMLify profile
files of /djdj/challange/
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function thirdMax($nums) {
$n
/**
* @param Integer[] $nums
* @return Integer
*/
function thirdMax($nums) {
$n
/*
https://www.hackerrank.com/challenges/
revising-the-select-query/problem
*/
SELECT *
FROM CITY
WHERE population > 100000
https://www.hackerrank.com/challenges/
revising-the-select-query/problem
*/
SELECT *
FROM CITY
WHERE population > 100000
/*
https://www.hackerrank.com/challenges/weather-observation-station-5/problem
*/
SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER
https://www.hackerrank.com/challenges/weather-observation-station-5/problem
*/
SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER
/*
https://www.hackerrank.com/challenges/weather-observation-station-6/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
https://www.hackerrank.com/challenges/weather-observation-station-6/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
/*
https://www.hackerrank.com/challenges/weather-observation-station-7/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
https://www.hackerrank.com/challenges/weather-observation-station-7/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
/*
https://www.hackerrank.com/challenges/weather-observation-station-8/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
https://www.hackerrank.com/challenges/weather-observation-station-8/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
/*
https://www.hackerrank.com/challenges/weather-observation-station-9/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
https://www.hackerrank.com/challenges/weather-observation-station-9/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CITY
/*
https://www.hackerrank.com/challenges/weather-observation-station-10/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CIT
https://www.hackerrank.com/challenges/weather-observation-station-10/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE CIT
/*
https://www.hackerrank.com/challenges/weather-observation-station-11/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE LEF
https://www.hackerrank.com/challenges/weather-observation-station-11/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE LEF
/*
https://www.hackerrank.com/challenges/weather-observation-station-12/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE LEF
https://www.hackerrank.com/challenges/weather-observation-station-12/problem
*/
SELECT DISTINCT CITY
FROM STATION
WHERE LEF
/*
https://leetcode.com/problems/combine-two-tables/description
*/
# Write your MySQL query statement below
Select firstName,
https://leetcode.com/problems/combine-two-tables/description
*/
# Write your MySQL query statement below
Select firstName,
/*
https://leetcode.com/problems/second-highest-salary/
*/
# Write your MySQL query statement below
select
(select distinct
https://leetcode.com/problems/second-highest-salary/
*/
# Write your MySQL query statement below
select
(select distinct
SELECT name
FROM city
WHERE countrycode = 'USA'
AND population > 120000;
FROM city
WHERE countrycode = 'USA'
AND population > 120000;
/*
https://leetcode.com/problems/employees-earning-more-than-their-managers/description/
*/
# Write your MySQL query statement
https://leetcode.com/problems/employees-earning-more-than-their-managers/description/
*/
# Write your MySQL query statement
# Write your MySQL query statement below
select email from person
group by email
having count(email) > 1;
select email from person
group by email
having count(email) > 1;
# Write your MySQL query statement below
select name as Customers from Customers
where id not in(select customerId from Orders);
select name as Customers from Customers
where id not in(select customerId from Orders);
# Write your MySQL query statement below
delete p1
from Person p1
inner join Person p2
on p1.email = p2.email
where p1.id > p2.i
delete p1
from Person p1
inner join Person p2
on p1.email = p2.email
where p1.id > p2.i
# Write your MySQL query statement below
SELECT w1.id
FROM Weather w1
JOIN Weather w2
ON DATEDIFF(w1.recordDate, w2.recordDate
SELECT w1.id
FROM Weather w1
JOIN Weather w2
ON DATEDIFF(w1.recordDate, w2.recordDate
# Write your MySQL query statement below
SELECT
player_id,
MIN(event_date) AS first_login
FROM
Activity
GROUP BY
SELECT
player_id,
MIN(event_date) AS first_login
FROM
Activity
GROUP BY
# Write your MySQL query statement below
SELECT name
FROM Employee
WHERE id IN (
SELECT managerId
FROM Employee
WHER
SELECT name
FROM Employee
WHERE id IN (
SELECT managerId
FROM Employee
WHER
# Write your MySQL query statement below
select name,bonus from employee
left join bonus
on bonus.empId = employee.empId
where b
select name,bonus from employee
left join bonus
on bonus.empId = employee.empId
where b
# Write your MySQL query statement below
select round(sum(tiv_2016),2) as tiv_2016
from Insurance
WHERE
tiv_2015 IN (
select round(sum(tiv_2016),2) as tiv_2016
from Insurance
WHERE
tiv_2015 IN (
# Write your MySQL query statement below
SELECT customer_number FROM Orders
GROUP BY customer_number
ORDER BY COUNT(*) desc limi
SELECT customer_number FROM Orders
GROUP BY customer_number
ORDER BY COUNT(*) desc limi
# Write your MySQL query statement below
select name,population,area from World
where area >= 3000000 or population >= 25000000;
select name,population,area from World
where area >= 3000000 or population >= 25000000;
# Write your MySQL query statement below
select class from courses
group by class
having count(class) >= 5
select class from courses
group by class
having count(class) >= 5
# Write your MySQL query statement below
SELECT MAX(num) AS num
FROM (
SELECT num
FROM MyNumbers
GROUP BY num
HA
SELECT MAX(num) AS num
FROM (
SELECT num
FROM MyNumbers
GROUP BY num
HA
# Write your MySQL query statement below
select * from cinema
where id % 2 = 1 and description != 'boring' order by rating desc;
select * from cinema
where id % 2 = 1 and description != 'boring' order by rating desc;
# Write your MySQL query statement below
update salary set sex = replace('m',sex,'f');
update salary set sex = replace('m',sex,'f');
# Write your MySQL query statement below
SELECT customer_id
FROM Customer
GROUP BY customer_id
HAVING COUNT(DISTINCT product_key
SELECT customer_id
FROM Customer
GROUP BY customer_id
HAVING COUNT(DISTINCT product_key
# Write your MySQL query statement below
select actor_id,director_id from ActorDirector
group by actor_id, director_id
Having c
select actor_id,director_id from ActorDirector
group by actor_id, director_id
Having c
# Write your MySQL query statement below
select product_name, year, price
from Sales
inner join Product
where Sales.product_i
select product_name, year, price
from Sales
inner join Product
where Sales.product_i
# Write your MySQL query statement below
select distinct p.project_id, Round(AVG(e.experience_years), 2) AS average_years
from
select distinct p.project_id, Round(AVG(e.experience_years), 2) AS average_years
from
# Write your MySQL query statement below
select distinct author_id as id
from Views
where author_id = viewer_id
order by id a
select distinct author_id as id
from Views
where author_id = viewer_id
order by id a
# Write your MySQL query statement below
select
p.product_id,
round(coalesce(sum(p.price * u.units) / sum(u.units),0), 2) a
select
p.product_id,
round(coalesce(sum(p.price * u.units) / sum(u.units),0), 2) a
# Write your MySQL query statement below
SELECT
s.student_id,
s.student_name,
sub.subject_name,
COUNT(e.subj
SELECT
s.student_id,
s.student_name,
sub.subject_name,
COUNT(e.subj
# Write your MySQL query statement below
SELECT
p.product_name,
SUM(o.unit) AS unit
FROM
Products AS p
LEFT JOIN
SELECT
p.product_name,
SUM(o.unit) AS unit
FROM
Products AS p
LEFT JOIN
# Write your MySQL query statement below
select unique_id,name from Employees
left join EmployeeUNI
on Employees.id = EmployeeUN
select unique_id,name from Employees
left join EmployeeUNI
on Employees.id = EmployeeUN
# Write your MySQL query statement below
SELECT
sell_date,
COUNT(DISTINCT product) AS num_sold,
GROUP_CONCAT(DISTI
SELECT
sell_date,
COUNT(DISTINCT product) AS num_sold,
GROUP_CONCAT(DISTI
# Write your MySQL query statement below
-- select * from Users where mail REGEXP '^[a-zA-Z][a-zA-Z0-9._-]*@leetcode\\.com$';
SE
-- select * from Users where mail REGEXP '^[a-zA-Z][a-zA-Z0-9._-]*@leetcode\\.com$';
SE
# Write your MySQL query statement below
SELECT * FROM patients
WHERE conditions LIKE '% DIAB1%' or conditions LIKE 'DIAB1%' ;
SELECT * FROM patients
WHERE conditions LIKE '% DIAB1%' or conditions LIKE 'DIAB1%' ;
# Write your MySQL query statement below
SELECT v.customer_id,
COUNT(v.visit_id) AS count_no_trans
FROM Visits v
LEFT JO
SELECT v.customer_id,
COUNT(v.visit_id) AS count_no_trans
FROM Visits v
LEFT JO
# Write your MySQL query statement below
SELECT user_id, CONCAT(UPPER(LEFT(name,1)),LOWER(SUBSTRING(name,2))) AS name
FROM Users
SELECT user_id, CONCAT(UPPER(LEFT(name,1)),LOWER(SUBSTRING(name,2))) AS name
FROM Users
# Write your MySQL query statement below
select tweet_id from Tweets where length(content) > 15;
select tweet_id from Tweets where length(content) > 15;
# Write your MySQL query statement below
select user_id, count(follower_id) as followers_count from Followers
group by user_id
o
select user_id, count(follower_id) as followers_count from Followers
group by user_id
o
# Write your MySQL query statement below
select product_id from Products
where low_fats = 'Y' and recyclable = 'Y'
select product_id from Products
where low_fats = 'Y' and recyclable = 'Y'
# Write your MySQL query statement below
SELECT employee_id, department_id
FROM Employee
WHERE primary_flag = 'Y'
OR employee
SELECT employee_id, department_id
FROM Employee
WHERE primary_flag = 'Y'
OR employee
import pandas as pd
def rearrange_products_table(products: pd.DataFrame) -> pd.DataFrame:
# return pd.melt(products, id_var
def rearrange_products_table(products: pd.DataFrame) -> pd.DataFrame:
# return pd.melt(products, id_var
SELECT user_id, MAX(time_stamp) AS last_stamp
FROM Logins
WHERE YEAR(time_stamp) = 2020
GROUP BY user_id;
FROM Logins
WHERE YEAR(time_stamp) = 2020
GROUP BY user_id;
# Write your MySQL query statement below
select 'Low Salary' as category, count(*) as accounts_count from Accounts where income
select 'Low Salary' as category, count(*) as accounts_count from Accounts where income
# Write your MySQL query statement below
select s.employee_id from Salaries as s
where s.employee_id NOT IN (select e.employee_i
select s.employee_id from Salaries as s
where s.employee_id NOT IN (select e.employee_i
# Write your MySQL query statement below
SELECT employee_id FROM Employees
WHERE salary < 30000 and manager_id not in (SELECT em
SELECT employee_id FROM Employees
WHERE salary < 30000 and manager_id not in (SELECT em
# Write your MySQL query statement below
select teacher_id, count(distinct subject_id) as cnt from Teacher
group by teacher_id;
select teacher_id, count(distinct subject_id) as cnt from Teacher
group by teacher_id;
# Write your MySQL query statement below
SELECT user_id, email
FROM Users
WHERE email REGEXP '^[A-Za-z0-9_]+@[A-Za-z]+.com';
SELECT user_id, email
FROM Users
WHERE email REGEXP '^[A-Za-z0-9_]+@[A-Za-z]+.com';
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
for(int i=0;i<nums.size();i++){
public:
vector<int> twoSum(vector<int>& nums, int target) {
for(int i=0;i<nums.size();i++){
class Solution {
/**
* @param Integer[] $nums1
* @param Integer[] $nums2
* @return Float
*/
functio
/**
* @param Integer[] $nums1
* @param Integer[] $nums2
* @return Float
*/
functio
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function removeDuplicates(&$nums) {
/**
* @param Integer[] $nums
* @return Integer
*/
function removeDuplicates(&$nums) {
class Solution {
/**
* @param Integer[] $nums
* @param Integer $val
* @return Integer
*/
function r
/**
* @param Integer[] $nums
* @param Integer $val
* @return Integer
*/
function r
class Solution {
/**
* @param Integer[] $nums
* @param Integer $target
* @return Integer[]
*/
funct
/**
* @param Integer[] $nums
* @param Integer $target
* @return Integer[]
*/
funct
int searchInsert(int* nums, int numsSize, int target) {
for (int i = 0; i < numsSize; i++) {
if (nums[i] >= target)
for (int i = 0; i < numsSize; i++) {
if (nums[i] >= target)
class Solution(object):
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
class Solution {
/**
* @param Integer[] $digits
* @return Integer[]
*/
function plusOne($digits) {
/**
* @param Integer[] $digits
* @return Integer[]
*/
function plusOne($digits) {
class Solution {
/**
* @param Integer[] $nums
* @return NULL
*/
function sortColors(&$nums) {
so
/**
* @param Integer[] $nums
* @return NULL
*/
function sortColors(&$nums) {
so
class Solution {
/**
* @param Integer[]
* @return Integer
**/
function singleNumber($nums) {
$re
/**
* @param Integer[]
* @return Integer
**/
function singleNumber($nums) {
$re
/*
https://www.hackerrank.com/challenges/weather-observation-station-3/problem
*/
SELECT DISTINCT city
FROM station
WHERE MOD
https://www.hackerrank.com/challenges/weather-observation-station-3/problem
*/
SELECT DISTINCT city
FROM station
WHERE MOD
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function majorityElement($nums) {
/**
* @param Integer[] $nums
* @return Integer
*/
function majorityElement($nums) {
class Solution {
/**
* @param Integer[] $nums
* @return Boolean
*/
function containsDuplicate($nums) {
/**
* @param Integer[] $nums
* @return Boolean
*/
function containsDuplicate($nums) {
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function missingNumber($nums) {
/**
* @param Integer[] $nums
* @return Integer
*/
function missingNumber($nums) {
class Solution {
/**
* @param Integer[] $nums
* @return NULL
*/
function moveZeroes(&$nums) {
$j
/**
* @param Integer[] $nums
* @return NULL
*/
function moveZeroes(&$nums) {
$j
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function findDuplicate($nums) {
/**
* @param Integer[] $nums
* @return Integer
*/
function findDuplicate($nums) {
class Solution {
/**
* @param Integer[] $nums1
* @param Integer[] $nums2
* @return Integer[]
*/
fun
/**
* @param Integer[] $nums1
* @param Integer[] $nums2
* @return Integer[]
*/
fun
class Solution {
/**
* @param String[] $words
* @return String[]
*/
function findWords($words) {
/**
* @param String[] $words
* @return String[]
*/
function findWords($words) {
class Solution {
/**
* @param Integer[] $nums
* @return Integer[]
*/
function findErrorNums($nums) {
/**
* @param Integer[] $nums
* @return Integer[]
*/
function findErrorNums($nums) {
int search(int* nums, int numsSize, int target) {
int lb=0, ub=numsSize-1, mid;
while(lb<=ub){
mid = (lb+ub)/2;
int lb=0, ub=numsSize-1, mid;
while(lb<=ub){
mid = (lb+ub)/2;
/*
https://www.hackerrank.com/challenges/weather-observation-station-1/problem
*/
SELECT city, state
FROM station;
https://www.hackerrank.com/challenges/weather-observation-station-1/problem
*/
SELECT city, state
FROM station;
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function pivotIndex($nums) {
/**
* @param Integer[] $nums
* @return Integer
*/
function pivotIndex($nums) {
class Solution {
/**
* @param String[] $letters
* @param String $target
* @return String
*/
functio
/**
* @param String[] $letters
* @param String $target
* @return String
*/
functio
class Solution {
/**
* @param Integer[] $nums
* @return Boolean
*/
function isMonotonic($nums) {
/**
* @param Integer[] $nums
* @return Boolean
*/
function isMonotonic($nums) {
class Solution(object):
def addToArrayForm(self, num, k):
"""
:type num: List[int]
:type k: int
def addToArrayForm(self, num, k):
"""
:type num: List[int]
:type k: int
class Solution {
/**
* @param Integer[] $arr
* @return Boolean
*/
function uniqueOccurrences($arr) {
/**
* @param Integer[] $arr
* @return Boolean
*/
function uniqueOccurrences($arr) {
class Solution {
/**
* @param Integer[][] $coordinates
* @return Boolean
*/
function checkStraightLine($
/**
* @param Integer[][] $coordinates
* @return Boolean
*/
function checkStraightLine($
class Solution {
/**
* @param Integer[] $nums
* @return Integer
*/
function findNumbers($nums) {
/**
* @param Integer[] $nums
* @return Integer
*/
function findNumbers($nums) {
class Solution {
/**
* @param Integer[] $arr
* @return Integer[]
*/
function arrayRankTransform($arr) {
/**
* @param Integer[] $arr
* @return Integer[]
*/
function arrayRankTransform($arr) {
class Solution {
/**
* @param Integer[][] $grid
* @return Integer
*/
function countNegatives($grid) {
/**
* @param Integer[][] $grid
* @return Integer
*/
function countNegatives($grid) {
class Solution {
/**
* @param Integer[] $nums
* @return Integer[]
*/
function smallerNumbersThanCurrent(
/**
* @param Integer[] $nums
* @return Integer[]
*/
function smallerNumbersThanCurrent(
/*
https://www.hackerrank.com/challenges/weather-observation-station-4/problem
*/
SELECT COUNT(city) - COUNT(DISTINCT CITY)
FR
https://www.hackerrank.com/challenges/weather-observation-station-4/problem
*/
SELECT COUNT(city) - COUNT(DISTINCT CITY)
FR