Author Archives: askmecode

How to find an apartment and roommates

Find an interesting website to find apartment and roommates in the Bay Area and San Francisco: Wanderful is an online marketplace for apartments and roommates. By partnering with luxury apartments, they provide renters more options for apartments sharing besides … Continue reading

Posted in Apartment rental and roommate finding, Uncategorized | Leave a comment

How to design chatbot

Chatbot vs GUI Chatbot is an alternative User Interface besides website and app, providing service to users. The advantage of conversational: 1. Easy to understand and simple to use. 2. Provides permanent canonical record. 3. Feel far more human. The … Continue reading

Posted in Uncategorized | Leave a comment

Median of Two Sorted Arrays

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). C++: 01 double kSmall(int A[],int m,int B[],int n,int k) 02 { … Continue reading

Posted in Array and linked list, Binary search | Leave a comment

Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. C++: 01 class Solution { 02 public: 03     string longestPalindrome(string s) { 04      … Continue reading

Posted in Array and linked list, String | Leave a comment

ZigZag Conversion

The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G … Continue reading

Posted in Array and linked list, String | Leave a comment

String to Integer (atoi)

Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be … Continue reading

Posted in Number trick, String | Leave a comment

Regular Expression Matching

Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). The function prototype should be: bool isMatch(const char *s, … Continue reading

Posted in Recursive, String | Leave a comment