Giter Site home page Giter Site logo

array-string-practice's Introduction

Array & String Practice

In this exercise you will practice using arrays & strings to solve coding problems, and then identify the time and space complexity of your solution. Try to write solutions with minimal time and space complexity.

Do not use the following methods:

  • reverse
  • reverse!

Learning Goals

  • Use loops, strings and arrays to solve coding problems
  • Identify the time & space complexity of a given method

Wave 1 - Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

Note: For the purpose of this problem, we define empty string as valid palindrome.

Palindrome Example 1

Input: "A man, a plan, a canal: Panama"
Output: true

Palindrome Example 2

Input: "race a car"
Output: false

Wave 2 - Longest Prefix

Write longest_prefix(strings) to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string "".

Longest Prefix Example 1

Input: ["flower","flow","flight"]
Output: "fl"
Example 2:

Longest Prefix Example 2

Input: ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input strings.

All given inputs are in lowercase letters a-z.

Source

Taken from leetcode.com:

array-string-practice's People

Contributors

cheezitman avatar hn4ever avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.