GithubHelp home page GithubHelp logo

panth-shah / leetcode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from walkccc/leetcode

0.0 0.0 0.0 4.85 MB

๐Ÿ’ก LeetCode in C++/Java/Python (respect coding conventions)

Home Page: https://walkccc.me/LeetCode

Python 21.68% C++ 39.27% Java 39.05%

leetcode's Introduction

LeetCode

LeetCode Solutions

Getting Started

This repository contains C++, Java, and Python solutions to LeetCode.

Also, I build a website by GitHub Actions to host the code files by Markdown files. You can see the built page here: LeetCode Solutions.

Coding Style

I believe messy code is costing you.

Therefore, I follow the formatter 99% of the time, but in rare situations, I format the code manually because it might look better in these cases.

Saving vertical rows and trying to squeeze everything in a single line disrespects the column limit and makes the code hard to read.

This repository aims to provide code with good readability and consistent style over various topics and embraces new standards. In most situations, readability has more value than lines of code and tiny performance hop.

Take a look at my nvim configuration related to auto formatting.

In ~/.config/nvim/init.lua:

local LUA_DIR = '$HOME/.config/nvim/lua/'

local function sourceLuaFiles(subpath)
  local p = io.popen('ls ' .. LUA_DIR .. subpath .. '| grep .lua')
  for filename in p:lines() do
    local fsPath = subpath .. filename
    local requirePath = fsPath:gsub('%.lua', ''):gsub('/', '.')
    require(requirePath)
  end
end

sourceLuaFiles('')
sourceLuaFiles('plugins/')

In ~/.config/nvim/lua/plugins.lua:

-- Use packer plugin
local status_ok, packer = pcall(require, 'packer')
if not status_ok then return end

-- Install your plugins here
return packer.startup(function(use)
  -- Null LS
  use 'jose-elias-alvarez/null-ls.nvim' -- for formatters and linters
end)

In ~/.config/nvim/lua/plugins/null-ls.lua:

local status_ok, null_ls = pcall(require, "null-ls")
if not status_ok then
  return
end

local formatting = null_ls.builtins.formatting

null_ls.setup {
  debug = false,
  sources = {
    formatting.autopep8.with { extra_args = { '--indent-size=2' } },
    formatting.clang_format,
  },
  on_attach = function(client)
    if client.resolved_capabilities.document_formatting then
      -- Format on save
      vim.cmd([[
      augroup LspFormatting
        autocmd! * <buffer>
        autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
      augroup END
      ]])
    end
  end,
}

More Information

The repository is still under construction, and the goal is to keep up with the growth of LeetCode problems by the end of the year!

For more information, please visit my GitHub.

Hosted the site on Feb 23, 2019.

Revised on Dec 25, 2019.

Added init.vim on Jan 18, 2021.

Updated to init.lua on Jan 1, 2022.

leetcode's People

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.