Search This Blog

Wednesday, March 24, 2021

Top Competitors- Hackerrank SQL

Julia just finished conducting a coding contest, and she needs your help assembling the leaderboard! Write a query to print the respective hacker_id and name of hackers who achieved full scores for more than one challenge. Order your output in descending order by the total number of challenges in which the hacker earned a full score. If more than one hacker received full scores in same number of challenges, then sort them by ascending hacker_id. Input Format The following tables contain contest data: Hackers: The hacker_id is the id of the hacker, and name is the name of the hacker. https://s3.amazonaws.com/hr-challenge-images/19504/1458526776-67667350b4-ScreenShot2016-03-21at7.45.59AM.png Difficulty: The difficult_level is the level of difficulty of the challenge, and score is the score of the challenge for the difficulty level. https://s3.amazonaws.com/hr-challenge-images/19504/1458526915-57eb75d9a2-ScreenShot2016-03-21at7.46.09AM.png Challenges: The challenge_id is the id of the challenge, the hacker_id is the id of the hacker who created the challenge, and difficulty_level is the level of difficulty of the challenge. https://s3.amazonaws.com/hr-challenge-images/19504/1458527032-f9ca650442-ScreenShot2016-03-21at7.46.17AM.png Submissions: The submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, challenge_id is the id of the challenge that the submission belongs to, and score is the score of the submission. https://s3.amazonaws.com/hr-challenge-images/19504/1458527077-298f8e922a-ScreenShot2016-03-21at7.46.29AM.png Sample Input Hackers Table:Difficulty Table: https://s3.amazonaws.com/hr-challenge-images/19504/1458527265-7ad6852a13-ScreenShot2016-03-21at7.46.50AM.png Challenges Table: https://s3.amazonaws.com/hr-challenge-images/19504/1458527285-01e95eb6ec-ScreenShot2016-03-21at7.46.40AM.png Submissions Table: https://s3.amazonaws.com/hr-challenge-images/19504/1458527241-6922b4ad87-ScreenShot2016-03-21at7.47.02AM.png Sample Output 90411 Joe Explanation Hacker 86870 got a score of 30 for challenge 71055 with a difficulty level of 2, so 86870 earned a full score for this challenge. Hacker 90411 got a score of 30 for challenge 71055 with a difficulty level of 2, so 90411 earned a full score for this challenge. Hacker 90411 got a score of 100 for challenge 66730 with a difficulty level of 6, so 90411 earned a full score for this challenge. Only hacker 90411 managed to earn a full score for more than one challenge, so we print the their hacker_id and name as space-separated values. solution sql query ------------------------------------------------------------------------ select h.hacker_id,h.name from hackers h, challenges c , difficulty d, submissions s where h.hacker_id=s.hacker_id and c.challenge_id=s.challenge_id and c.difficulty_level=d.difficulty_level and s.score=d.score group by h.hacker_id,h.name having count(h.hacker_id)>1 order by count(c.challenge_id) desc,h.hacker_id

Tuesday, March 23, 2021

Hackerrank Quetions- java

Q. Output the correct day in capital letters. Sample Input 08 05 2015 Sample Output WEDNESDAY ------------------------------------------------------ import java.time.LocalDate; class Result { /* * Complete the 'findDay' function below. * * The function is expected to return a STRING. * The function accepts following parameters: * 1. INTEGER month * 2. INTEGER day * 3. INTEGER year */ public static String findDay(int month, int day, int year) { return LocalDate.of(year, month, day).getDayOfWeek().name(); } } ----------------------------------------------------------------------

Monday, March 22, 2021

E: Sub-process /usr/bin/dpkg returned an error code (2) - SOLUTION

sudo rm /var/lib/dpkg/available sudo touch /var/lib/dpkg/available sudo sh -c 'for i in /var/lib/apt/lists/*_Packages; do dpkg --merge-avail "$i"; done' If previous instruction does not solve the problem... sudo dpkg --configure -a sudo apt-get -f install sudo apt-get clean sudo apt-get update && sudo apt-get upgrade

Installing SQLite 3

Installing SQLite 3 First update the apt package repository cache with the following command: $ sudo apt-get update The apt package repository cache should be updated. Now to install SQLite 3, run the following command: $ sudo apt-get install sqlite3 SQLite 3 should be installed. Now you can check whether SQLite 3 is working with the following command: $ sqlite3 --version Installing SQLite Browser Run the following command to install SQLite Browser: $ sudo apt-get install sqlitebrowser Now press y and then press . SQLite Browser should be installed. Using SQLite using SQLite Browser Now you can go to the Application Menu and search for SQLite Browser. You should see a database icon as marked in the screenshot below. Click on it.

Sunday, March 21, 2021

compile and run springboot program using terminal

Build program ---> mvn clean install Run Project ----> mvn clean package Set properties.yml file ------------------------------------------------------------------ spring: profiles:dev server: port:8000 --- spring: profiles:test server: port:9000 ------------------------------------------------------------------ Set Environment variable(dev or test) environment using following ncommand: or How to pass Environment variable to JVM

Build ig Failing using terminal || Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project

Solution Add build dependency in pom.xml ------------------------------------------------------------------------------------------------------- org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 --------------------------------------------------------------------------------------------------------------

Thursday, March 18, 2021

Best place to learn anything

http://www.noexcuselist.com/

Java FAQ

What makws java Platform Independent? Ans --1. Bytecode 2. JVM

Thursday, March 11, 2021

i18n Codes

The importance of locales is that your environment/os can provide formatting functionality for all installed locales even if you don't know about them when you write your application. My Windows 7 system has 211 locales installed (listed below), so you wouldn't likely write any custom code or translation specific to this many locales. The most important thing for various versions of English is in formatting numbers and dates. Other differences are significant to the extent that you want and able to cater to specific variations. af-ZA am-ET ar-AE ar-BH ar-DZ ar-EG ar-IQ ar-JO ar-KW ar-LB ar-LY ar-MA arn-CL ar-OM ar-QA ar-SA ar-SY ar-TN ar-YE as-IN az-Cyrl-AZ az-Latn-AZ ba-RU be-BY bg-BG bn-BD bn-IN bo-CN br-FR bs-Cyrl-BA bs-Latn-BA ca-ES co-FR cs-CZ cy-GB da-DK de-AT de-CH de-DE de-LI de-LU dsb-DE dv-MV el-GR en-029 en-AU en-BZ en-CA en-GB en-IE en-IN en-JM en-MY en-NZ en-PH en-SG en-TT en-US en-ZA en-ZW es-AR es-BO es-CL es-CO es-CR es-DO es-EC es-ES es-GT es-HN es-MX es-NI es-PA es-PE es-PR es-PY es-SV es-US es-UY es-VE et-EE eu-ES fa-IR fi-FI fil-PH fo-FO fr-BE fr-CA fr-CH fr-FR fr-LU fr-MC fy-NL ga-IE gd-GB gl-ES gsw-FR gu-IN ha-Latn-NG he-IL hi-IN hr-BA hr-HR hsb-DE hu-HU hy-AM id-ID ig-NG ii-CN is-IS it-CH it-IT iu-Cans-CA iu-Latn-CA ja-JP ka-GE kk-KZ kl-GL km-KH kn-IN kok-IN ko-KR ky-KG lb-LU lo-LA lt-LT lv-LV mi-NZ mk-MK ml-IN mn-MN mn-Mong-CN moh-CA mr-IN ms-BN ms-MY mt-MT nb-NO ne-NP nl-BE nl-NL nn-NO nso-ZA oc-FR or-IN pa-IN pl-PL prs-AF ps-AF pt-BR pt-PT qut-GT quz-BO quz-EC quz-PE rm-CH ro-RO ru-RU rw-RW sah-RU sa-IN se-FI se-NO se-SE si-LK sk-SK sl-SI sma-NO sma-SE smj-NO smj-SE smn-FI sms-FI sq-AL sr-Cyrl-BA sr-Cyrl-CS sr-Cyrl-ME sr-Cyrl-RS sr-Latn-BA sr-Latn-CS sr-Latn-ME sr-Latn-RS sv-FI sv-SE sw-KE syr-SY ta-IN te-IN tg-Cyrl-TJ th-TH tk-TM tn-ZA tr-TR tt-RU tzm-Latn-DZ ug-CN uk-UA ur-PK uz-Cyrl-UZ uz-Latn-UZ vi-VN wo-SN xh-ZA yo-NG zh-CN zh-HK zh-MO zh-SG zh-TW zu-ZA