We can use 26 length array for storing frequency of elements for problems with only lowercase english alphabet input.
int[]freq = new int[26];
When recursion is banned you can use stack to simulate. DFS iterative
import React from 'react' | |
import ReactDOM from 'react-dom' | |
import PropTypes from 'prop-types' | |
// Instead of using a HOC, we can share code using a | |
// regular component with a render prop! | |
class Mouse extends React.Component { | |
static propTypes = { | |
render: PropTypes.func.isRequired | |
} |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import SelectDropdown, {CHECK_MARK} from './SelectDropdown'; | |
/** | |
* Uses render prop to reuse SelectDropdown functionalities | |
* @author skh | |
*/ | |
export default class CountryFilter extends Component { |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import SelectDropdown, {CHECK_MARK} from './SelectDropdown'; | |
/** | |
* Uses render prop to reuse SelectDropdown functionalities | |
* @author skh | |
*/ | |
export default class CountryFilter extends Component { |
import {withRouter} from 'react-router-dom'; | |
class Trips extends React.Component { | |
render() { | |
const { location: { pathname } } = this.props | |
return ( | |
<h1>Hello people, currenty at: {pathname}</h1> | |
) | |
} | |
} |
const GalleryItem = ({ url, alt, description, alt, author }) => ( | |
<div className="img-container"> | |
<img src={url} alt={alt} /> | |
{description} - {author} | |
</div> | |
); | |
class Gallery extends Component { | |
state = { | |
isLoading: false, |
const GalleryItem = ({ url, alt, description, alt, author }) => ( | |
<div className="img-container"> | |
<img src={url} alt={alt} /> | |
{description} - {author} | |
</div> | |
) |
class Gallery extends Component { | |
state = { | |
isLoading: false, | |
currentImage: 0, | |
imgs: [], | |
}; | |
componentDidMount() { | |
this.setState({ isLoading: true }); | |
// AJAX API call here |