Skip to content

Code Says

C code. C code run. Run code run… please!

  • Home
  • Cracking the Coding Interview
  • Codility
  • Jobdu OJ
  • LeetCode
  • Privacy Policy
  • Contact Me
  • Home
  • Cracking the Coding Interview
  • Codility
  • Jobdu OJ
  • LeetCode
  • Privacy Policy
  • Contact Me

Category Archives: Java

Solution to Find the Abnormal Number

29 Aug

This morning, I suddenly remembered this challenge. But I nearly forgot the answer. I’d better to record it here for latter review. Question Name: Find the Abnormal Number Question Description: in a given integer array, every number, except one, appears … Read More »

Interview Questions, Java 2 Comments

Solution to Greatest Sum Of Subarrays from Jobdu

28 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1372 Question Name: Greatest Sum Of Subarrays Question Description: Given an integer array, find the non-empty subarray with the greatest sum. If there are multiple subarray with the same greatest sum, return the one with the smallest … Read More »

Java, Jobdu OJ 2 Comments

Solution to K Least Numbers from Jobdu

27 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1371 Question Name: K Least Numbers Question Description: Given an integer array and an integer K, find the sorted K least numbers in the original array. Input: the input might contain multiple test cases. Each test case … Read More »

Java, Jobdu OJ Leave a comment

Solution to More Than Half Number from Jobdu

25 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1370 Question Name: More Than Half Number Question Description: Give an integer array, there might be one number, which appears more than half times. If it exists, find out it. For example, in the array {1,2,3,2,2,2,5,4,2}, 2 … Read More »

Java, Jobdu OJ 2 Comments

Solution to String Permutation from Jobdu

24 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1369 Question Name: String Permutation Question Description: Give a string, use all the letters of that string to construct all distinct permutations. Input: the input might contain multiple test cases. Each line contains a string as a … Read More »

Java, Jobdu OJ Leave a comment

Solution to Convert Binary Search Tree from Jobdu

24 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1503 Question Name: Convert Binary Search Tree Question Description: Given a binary search tree, convert it to a sorted and double-linked list. You cannot create any new node. But the pointers in each node could be modified. … Read More »

Java, Jobdu OJ Leave a comment

Solution to Copy Complex List from Jobdu

20 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1524 Question Name: Copy Complex List Question Description: In a complex list, each node has two pointers. One pointer is to the next node. And the other is to a random node of the list. Given a … Read More »

Java, Jobdu OJ Leave a comment

Solution to Path In Tree from Jobdu

18 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1368 Question Name: Path In Tree Question Description: Given a binary tree and a value, show all the paths, whose sum is equal to the given value. A path is defined as the route from root to … Read More »

Java, Jobdu OJ Leave a comment

Solution to Sequence Of BST from Jobdu

12 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1367 Question Name: Sequence Of BST Question Description: Give an array, check whether it is possble to be the post-order traversal result on some binary search tree. Input: the input might contain multiple test cases. Inside each … Read More »

Java, Jobdu OJ Leave a comment

Solution to Print Binary Tree By Level from Jobdu

11 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1523 Question Name: Print Binary Tree By Level Question Description: Give a binary tree, print it out in level-order. Input: the input might contain multiple test cases. Inside each test case, the first line includes one interger … Read More »

Java, Jobdu OJ Leave a comment

Posts navigation

← 1 2 3 4 5 6 →

Guideline for Comments

tl;dr: Please put your code into a <pre>YOUR CODE</pre> section.

Hello everyone!

If you want to ask a question about the solution. DO READ the post and comments firstly.

If you had some troubles in debugging your solution, please try to ask for help on StackOverflow, instead of here.

If you want to post some comments with code or symbol, here is the guidline.

1. To post your code, please add the code inside a <pre> </pre> section (preferred), or <code> </code>. And inside the pre or code section, you do not need to escape < > and &, e.g. no need to use &lt; instead of <.

2. To use special symbols < and > outside the pre block, please use "&lt;" and "&gt;" instead.

3. If you have a comment with lots of < and >, you could add the major part of your comment into a <pre class="decode:true crayon-inline "> YOUR COMMENTS </pre> section.

Finally, if you are posting the first comment here, it usually needs moderation. Please be patient and stay tuned. Thanks!

CodeSays.com Admin

Recent Comments

  • parikshit verma July 5, 2023 at 8:26 am on Solution to Missing-Integer by codility def missingnum(a): st=min(a) en=max(a) b=set(range(1,en+2)) if (en<1 or st>1) : return 1 else: return min(b-set(a))
  • Pavankumar Nandeshwar June 26, 2023 at 8:07 am on Solution to Dwarfs-Rafting by codilityOk fixed it. gives 100%: int solution(int N, string &S, string &T) { int q = N / 2 * N / 2; int lf...
  • Pavankumar Nandeshwar June 26, 2023 at 5:23 am on Solution to Dwarfs-Rafting by codilityCan someone explain what is wrong with my solution in C++ ? int solution(int N, string &S, string &T) { int q = N /...
  • Pavankumar Nandeshwar June 23, 2023 at 10:25 pm on Solution to Flood-Depth by codilityMy C++ Solution. O(N) #include <climits> int solution(vector<int> &A) { int max_depth {}; int max_lvl = {}; int min_lvl = INT_MAX; for (unsigned int i...
  • Carlos Martínez Trueba June 21, 2023 at 4:45 pm on Solution to Count-Distinct-Slices by codilityWell, I have tried this one with C#. Apparently, everything is correct, my code is correct and efficient, but for particularly one of the tests...
  • Jay Bariya April 28, 2023 at 11:11 pm on Solution to Brackets by codilityCompletely uneccessary solution using numbers. Python solution - O(N). def solution(S): bracket_map = {"{":10,"}":-10,"[":20,"]":-20,"(":30,")":-30} #check if even number of brackets N = len(S) if N...
  • Jay Bariya April 28, 2023 at 11:08 pm on Solution to Brackets by codilityVery nice solution!
  • Jay Bariya January 18, 2023 at 3:54 pm on Solution to Triangle by codilityI initially solved it using how Sheng did to just find the mere existence of a trianglular. My code can be modified to find all...
  • Jay Bariya January 17, 2023 at 1:23 am on Solution to Max-Product-Of-Three by codility100% Python solution. Hi @Sheng, I tried solving it without using sorting. Just min and max. I believe my complexity is O(N), but Codility shows...

Categories

  • Announcement
  • C/C++
  • Codility
  • Interview Questions
  • Java
  • Jobdu OJ
  • LeetCode
  • Linux
  • Others
  • Python
  • Solutions-CTCI
  • SQL

Tags

algorithm AppFog C codility Crawler CTCI Hash Set Interview Linux LMR pcapy PHP python rotation shuffle Utility WordPress

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2023 Code Says
Powered by WordPress / Theme by Design Lab
  • Contact Me
  • About Me
  • Privacy Policy