Get all the distinct user_ids who liked at least one video uploaded by Android Authority Channel (channel__id = 364) but didn't like the video uploaded by Tech savvy channel with video_id = 1005.
user_id
Get the number of users who possitively engaged with at least one video of Disney Channel (channel_id = 352).
no_of_users_reached
Get the top 10 channels for which more number of users are subscribed in the year 2018.
In case, if the no_of_subscribers are same, then sort the output in the ascending order of channel_name.
channel_id channel_name no_of_subscribers
Declares an array of 20 components; initializes list[0] to 4 and list[1] to 7; all other components are initialized to 0.
implement a Java program to make a chat platform using synchronization between 3 threads.
similar code like below:
class Chat {
boolean fl = false;
public synchronized void Ques(String g) {
if (fl) {
try {
wait();
}catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println(g);
fl=true;
notify();
}
public synchronized void Ans(String g) {
if (!fl) {
try {
wait();
}catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println(g);
fl=false;
notify();
}}
class T1 implements Runnable{
Chat m;
String[] s1={"Hi","How r u ?"};
public T1(Chat m1) {
this.m=m1;
new Thread(this,"Ques").start();
}
public void run() {
for (int i=0;i<s1.length;i++) {
m.Ques(s1[i]);
}}}
class T2 implements Runnable {
Chat m;
String[] s2={ "Hi","Great" };
public T2(Chat m2) {
this.m=m2;
new Thread(this,"Ans").start();
}
public void run() {
for (int i=0;i<s2.length;i++) {
m.Ans(s2[i]);
}}}
public class TestThread {
public static void main(String[] args) {
Chat m=new Chat();
new T1(m);
new T2(m);
}}An array is type of data structure that stores the elements in contiguous block of memory, create an array with name "list" and size of an array is N. your task is to print the array elements in an reverse order.
list-[1,2,3,4,5)
output 5,4,3,2,1
Note: use function concept to process the array elements and print it in the reverse order.
Reverse array has the following parameter
int list[n]
return int
You are given a string. Repeat the same string N times separated by space.
Explanation
In the given example the string is messages, N = 3. So we have to repeat the string three times. Then we get messages messages messages as output.
Sample Input 1
message
3
Sample Output 1
message message message
Sample Input 2
pop
4
Sample Output 2
pop pop pop pop