Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

This is the code for Getting all the channel_ids that uploaded at least one video in "AI/ML" or "Robotics" technologies between 2018 and 2021.


SELECT

 DISTINCT channel_id

FROM

 video

WHERE

 video_id >= 1

 AND name LIKE '%AI/ML%'

 OR name LIKE '%Robotics%'

 AND strftime('%Y', published_datetime) BETWEEN "2018"

 AND "2021"

GROUP BY

 channel_id

ORDER BY

 channel_id ASC;


Output Table:

channel_id
    351
    353
    364
    365
    377


But,

How can I Get all the channel_ids that uploaded at least 20 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 5 videos in AI/ML, 10 videos in Cyber Security and 5 videos in Data Science, consider the channel


the table data is very huge so, I cant send the complete table data.

please help me.




Find the sum of durations of the videos published by each channel in hours.


Note:

  • The output must contain the duration as number of hours.
  • Sort the output in the descending order of the no_of_hours

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365




Expected Output Format

  channel_id	no_of_hours
      ...	       ...

Get all the channel_ids that uploaded at least 5 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 2 videos in AI/ML, 1 videos in Cyber Security and 2 videos in Data Science, consider the channel.


Note:

  • Consider all the videos that have any of the technologies mentioned above in their name
  • Sort the output in the ascending order of channel_id.

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365




Expected Output Format

 channel_id
     ...
Get the distinct ids of videos that belong to the following genres.

genre_id	genre
201	        Comedy
202	        Action
203	        Thriller
211	         Scifi
Note:
Sort the output in the descending order of
video_id
Expected Output Format
video_id
...
genre_id genre_type
201       ACTION 
202       COMEDY
203       THRILLER
204       ROMANTIC
205        TECHNICAL
206       HEALTH CARE
207       GAMING
208       MUSIC VIDEOS
209       TEASER
210        INSPIRATIONAL
211       SCI-FI
Tic-Tac-Toe game
Abhinav and Anjali are playing the Tic-Tac-Toe game. Tic-Tac-Toe is a game played on a grid that's three squares by three squares. Abhinav is O, and Anjali is X. Players take turns putting their marks in empty squares. The first player to get 3 of her marks in a diagonal or horizontal, or vertical row is the winner. When all nine squares are complete, the game is over. If no player has three marks in a row, the game ends in a tie. Write a program to decide the winner in the Tic-Tac-Toe game.
Input

The input will be three lines contain O's and X's separated by space.
Output

The output should be a single line containing either "Abhinav Wins" or "Anjali Wins" or "Tie".
Explanation

For example, if the input is 

O X O
O X X
O O X 

 
as three of O's are in vertical row print "Abhinav Wins".
Sample Input 1
O X O
O X X
O O X
Sample Output 1
Abhinav Wins

Sample Input 2
O O X
X X O
X O O
Sample Output 2
Anjali Wins
Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0 format.
Input

The first line contains a single integer N. 
Next N lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.
Output

Print the polynomial in the format Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is coefficient, and C0 is constant. There will be space before and after the plus or minus sign. 
If the coefficient is zero, then don't print the term. 
If the term with the highest degree is negative, the term should represent  -Cix^Pi. 
For the term where power is 1, represent it as C1x instead of C1x^1. 
If the polynomial degree is zero and the constant term is also zero, then print 0 to represent the polynomial.
For term Cix^Pi, if the coefficient of the term Ci is 1, print x^Pi instead of 1x^Pi.
Explanation

If N = 4
For power 0, the coefficient is 5
For power 1, the coefficient is 0
For power 2, the coefficient is 10
For power 3, the coefficient is 6.
Then polynomial represents "6x^3 + 10x^2 + 5"
Constraints

N <= 100
0 <= Pi < 1000
-1000 <= Ci <= 1000
Sample Input 
4
0 5
1 0
2 10
3 6
Sample Output 
6x^3 + 10x^2 + 5
Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.
Input

The input will be a single line containing a sentence S.
Output

The output contains multiple lines, with each line containing a word and its count separated by ": " with the order of appearance in the given sentence.
Explanation

For example, if the given sentence is "Hello world, welcome to python world", the output should be 
Hello: 1
world: 2
welcome: 1
to: 1
python: 1
Sample Input 1
Hello world welcome to python world
Sample Output 1
Hello: 1
world: 2
welcome: 1
to: 1
python: 1

Sample Input 2
This is my book
Sample Output 2
This: 1
is: 1
my: 1
book: 1
You are given a square matrix A of dimensions NxN. You need to apply the below given 3 operations on the matrix A.

Rotation: It is represented as R S where S is an integer in {90, 180, 270, 360, 450, ...} which denotes the number of degrees to rotate. You need to rotate the matrix A by angle S in the clockwise direction. The angle of rotation(S) will always be in multiples of 90 degrees.

Update: It is represented as U X Y Z. In initial matrix A (as given in input), you need to update the element at row index X and column index Y with value Z.
After the update, all the previous rotation operations have to be applied to the updated initial matrix.

Querying: It is represented as Q K L. You need to print the value at row index K and column index L of the matrix A. 
Input

The first line contains a single integer N.
Next N lines contain N space-separated integers Aij (i - index of the row, j - index of the column).
Next lines contain various operations on the array. Each operation on each line (Beginning either with R, U or Q).
-1 will represent the end of input.
Output

For each Query operation print the element present at row index K and colum index L of the matrix in its current state.
Explanation

For Input:
2
1 2
3 4
R 90
Q 0 0
Q 0 1
R 90
Q 0 0
U 0 0 6
Q 1 1
-1

Initial Matrix
1 2
3 4

For R 90, clockwise rotation by 90 degrees, the matrix will become
3 1
4 2

For Q 0 0, print the element at row index 0 and column index 0 of A, which is 3. 
For Q 0 1, print the element at row index 0 and column index 1 of A, which is 1. 

Again for R 90, clockwise rotation by 90 degrees, the matrix will become
4 3
2 1

For Q 0 0, print the element at row index 0 and column index 0 of A, which is 4. 

For U 0 0 6, update the value at row index 0 and column index 1 in the initial matrix to 6. So the updated matrix will be,
6 2
3 4
After updating, we need to rotate the matrix by sum of all rotation angles applied till now(i.e. R 90 and R 90 => 90 + 90 => 180 degrees in clockwise direction).
After rotation the matrix will now become
4 3
2 6

Next for Q 1 1, print the element at row index 1 and column index 1 of A, which is 6. 
output 
3
1
4
6
Sample Input 1
2
1 2
3 4
R 90
Q 0 0
Q 0 1
R 90
Q 0 0
U 0 0 6
Q 1 1
-1
Sample Output 1
3
1
4
6

Sample Input 2
2
5 6
7 8
R 90
Q 0 1
R 270
Q 1 1
R 180
U 0 0 4
Q 0 0
-1
Sample Output 2
5
8
8

Get all the channel_ids that uploaded at least 5 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.

Example: If a channel publishes 2 videos in AI/ML, 1 videos in Cyber Security and 2 videos in Data Science, consider the channel.

Note:

  • Consider all the videos that have any of the technologies mentioned above in their name
  • Sort the output in the ascending order of channel_id.

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365



Expected Output Format

 channel_id
     ...

Find the sum of durations of the videos published by each channel in hours.

Note:

  • The output must contain the duration as number of hours.
  • Sort the output in the descending order of the no_of_hours

Table: Video

video_id	name	duration_in_secs	published_datetime	no_of_views	   channelid
1002   Victoria Beckham
        Gives Strangers 
        Fashion Advice      836	         2021-01-19 20:12	    75609	      353
       for $2 in Central 
       Park | Vanity Fair	
	
1007	DIY - Simon's Cat  
       |NEW BLACK & WHITE!	 1365	     2012-09-07 11:32	    106271	      355

1008	You, but in emojis.
        (YIAY #375)	         3874	     2021-01-19 20:12	    16469	      352

1009	100 People Hold 
       Their Breath for as   2885	     2015-05-17 19:32	    272102	      354
       Long as They Can	     

1010	Luke Bryan - Hooked
          On It (Audio)	     2106	     2016-02-10 12:32	    184471	      366

1011	The perfect ice - 
          Ice boats on       2549	     2020-07-10 15:32	    108047	      352
           Lake Geneva	

1012	5 Days Of Wearing 
        DIY Makeup | Try     3172	     2018-11-05 08:32	    178623	      358
       Living With Lucie 
        | Refinery29	

1013	Idiot's Guide to 
      Japanese Squat Toilets  709	     2009-08-05 11:32	    44293	      356

1019	Vostok Brompton Beach 
                Ride	        2022	 2016-04-05 19:00	    204704	      367

1020	SHOPPING FOR NEW FISH!! 3496	 2021-01-19 20:12	    294429	      359

1021	Paramore: Fake Happy 
           [OFFICIAL VIDEO]	    1397	 2015-07-05 19:00	    245138	      368

1022	Howard Stern: George 
      Takei Talks About Harvey 
        Weinstein and Sexually  776	     2021-01-19 20:12	    35875	      360
                Assault	

1023	Tony Hawk Answers 
      Skateboarding Questions   4476	 2017-02-17 19:32	    143404	      354
           From Twitter |
        Tech Support | WIRED	

1024	Kimbra - Top of the 
        World (Official Music   3243	 2015-01-05 19:00	    220673	      368
               Video)	

1025	Aly Raisman On Dr. 
      Larry Nassar’s Medical 
      Treatment: I Didn’t Know  2978	 2014-12-17 19:32	     93272	      354
      It Was Abuse | Megyn Kelly 
             TODAY	

1026	When Someone Has A 
     Crush on You | Lilly Singh	 959	 2021-01-19 20:12	     139481	      360

1051	Demi Lovato - Sorry 
   Not Sorry in the Live Lounge	 3929	 2021-01-19 20:12	     265864	      365



Expected Output Format

  channel_id	no_of_hours
      ...	       ...
LATEST TUTORIALS
APPROVED BY CLIENTS