{ "data": { "question": { "questionId": "3432", "questionFrontendId": "3124", "boundTopicId": null, "title": "Find Longest Calls", "titleSlug": "find-longest-calls", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Medium", "likes": 3, "dislikes": 1, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"Contacts\":[\"id\",\"first_name\",\"last_name\"],\"Calls\":[\"contact_id\",\"type\",\"duration\"]},\"rows\":{\"Contacts\":[[1,\"John\",\"Doe\"],[2,\"Jane\",\"Smith\"],[3,\"Alice\",\"Johnson\"],[4,\"Michael\",\"Brown\"],[5,\"Emily\",\"Davis\"]],\"Calls\":[[1,\"incoming\",120],[1,\"outgoing\",180],[2,\"incoming\",300],[2,\"outgoing\",240],[3,\"incoming\",150],[3,\"outgoing\",360],[4,\"incoming\",420],[4,\"outgoing\",200],[5,\"incoming\",180],[5,\"outgoing\",280]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"217\", \"totalSubmission\": \"266\", \"totalAcceptedRaw\": 217, \"totalSubmissionRaw\": 266, \"acRate\": \"81.6%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Contacts\":[\"id\",\"first_name\",\"last_name\"],\"Calls\":[\"contact_id\",\"type\",\"duration\"]},\"rows\":{\"Contacts\":[[1,\"John\",\"Doe\"],[2,\"Jane\",\"Smith\"],[3,\"Alice\",\"Johnson\"],[4,\"Michael\",\"Brown\"],[5,\"Emily\",\"Davis\"]],\"Calls\":[[1,\"incoming\",120],[1,\"outgoing\",180],[2,\"incoming\",300],[2,\"outgoing\",240],[3,\"incoming\",150],[3,\"outgoing\",360],[4,\"incoming\",420],[4,\"outgoing\",200],[5,\"incoming\",180],[5,\"outgoing\",280]]}}", "metaData": "{\"mysql\": [\"Create table if Not Exists Contacts(id int, first_name varchar(20), last_name varchar(20))\", \"Create table if Not Exists Calls(contact_id int, type ENUM('incoming', 'outgoing'), duration int)\"], \"mssql\": [\"Create table Contacts(id int, first_name varchar(20), last_name varchar(20))\", \"Create table Calls(contact_id int, type varchar(20) NOT NULL CHECK (type in ('incoming' , 'outgoing')), duration int)\"], \"oraclesql\": [\"Create table Contacts(id int, first_name varchar(20), last_name varchar(20))\", \"Create table Calls(contact_id int, type varchar(20) NOT NULL CHECK (type in ('incoming' , 'outgoing')), duration int)\"], \"database\": true, \"name\": \"find_longest_calls\", \"pythondata\": [\"Contacts = pd.DataFrame([], columns=['id', 'first_name', 'last_name']).astype({'id':'Int64', 'first_name':'object', 'last_name':'object'})\\n\", \"Calls = pd.DataFrame([], columns=['contact_id', 'type', 'duration']).astype({'contact_id': 'Int64', 'type': 'category', 'duration': 'Int64'})\\n\"], \"postgresql\": [\"CREATE TABLE Contacts (\\n id SERIAL PRIMARY KEY,\\n first_name VARCHAR(20),\\n last_name VARCHAR(20)\\n);\\n\", \"CREATE TABLE Calls (\\n contact_id INT,\\n type VARCHAR(20) NOT NULL CHECK (type IN ('incoming', 'outgoing')),\\n duration INT\\n);\\n\"], \"manual\": true, \"database_schema\": {\"Contacts\": {\"id\": \"INT\", \"first_name\": \"VARCHAR(20)\", \"last_name\": \"VARCHAR(20)\"}, \"Calls\": {\"contact_id\": \"INT\", \"type\": \"ENUM('incoming', 'outgoing')\", \"duration\": \"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table if Not Exists Contacts(id int, first_name varchar(20), last_name varchar(20))", "Create table if Not Exists Calls(contact_id int, type ENUM('incoming', 'outgoing'), duration int)", "Truncate table Contacts", "insert into Contacts (id, first_name, last_name) values ('1', 'John', 'Doe')", "insert into Contacts (id, first_name, last_name) values ('2', 'Jane', 'Smith')", "insert into Contacts (id, first_name, last_name) values ('3', 'Alice', 'Johnson')", "insert into Contacts (id, first_name, last_name) values ('4', 'Michael', 'Brown')", "insert into Contacts (id, first_name, last_name) values ('5', 'Emily', 'Davis')", "Truncate table Calls", "insert into Calls (contact_id, type, duration) values ('1', 'incoming', '120')", "insert into Calls (contact_id, type, duration) values ('1', 'outgoing', '180')", "insert into Calls (contact_id, type, duration) values ('2', 'incoming', '300')", "insert into Calls (contact_id, type, duration) values ('2', 'outgoing', '240')", "insert into Calls (contact_id, type, duration) values ('3', 'incoming', '150')", "insert into Calls (contact_id, type, duration) values ('3', 'outgoing', '360')", "insert into Calls (contact_id, type, duration) values ('4', 'incoming', '420')", "insert into Calls (contact_id, type, duration) values ('4', 'outgoing', '200')", "insert into Calls (contact_id, type, duration) values ('5', 'incoming', '180')", "insert into Calls (contact_id, type, duration) values ('5', 'outgoing', '280')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"
MySQL 8.0
.
mssql server 2019
.
Oracle Sql 11.2
.
Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0
\"], \"postgresql\": [\"PostgreSQL\", \"PostgreSQL 16
\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }